The following script will clear the screen because ‘document.write’ is used.
How can I change the following php script without using ‘document.write’ but achieving the same results?
[code=php]
<?php
echo “<br>”;
define(‘MAX_RESULTS’, 12);
$playlist = ‘/var/icecast/log/playlist.log’;
$fp = fopen($playlist, ‘r’);
$results = array();
while (($parts = fgetcsv($fp, 0, ‘|’)) !== FALSE)
{
if ((count($parts) != 4) || (strpos($parts[1], ‘/stream’) === false)) {
continue;
}
$date = DateTime::createFromFormat(‘d/M/Y:H:i:s O’, $parts[0]);
$results[] = sprintf(“<h1 class=’playlist-time’><script>document.write(Globalize.format( new Date(‘Thu, Jun 01, 2015 %s:00 GMT+0100 (BST)’), ‘HH:mm’));</script></h1>n<h1 class=’playlist-track’>%s</h1>”, $date->format(‘H:i’), $parts[3]);
if (count($results) > MAX_RESULTS) {
array_shift($results);
}
}
foreach (array_reverse($results) as $item) {
echo “$item”;
}
echo “<br>”;
?>