I was hoping to reuse the php code that loads the text file, so what I wanted from the ticker was
run php code that displays file1.txt wait 40seconds
run php code that displays file2.txt wait 40 seconds
then loop back to file 1.txt wait 40secs etc
the php is
PHP Code:
<?php
//$file = fopen ("/ftp/gsyharr.txt", "r");
$file = fopen ("http://www.thisisguernsey.co.uk/thirdparty/gsyharr.txt", "r");
if (!$file) {
echo "<p>Unable to open remote file.\n";
exit;
}
?><table cellpadding=0 width=440 cellspacing=5 align=center border=0>
<?php
while (!feof ($file)) {
$line = fgets ($file, 1024);
/* this only works if the title and its tags are on one line */
$vessel = substr($line, 2,13);
$destination = substr($line, 15,13);
$duetime = substr($line, 28,5);
$actualtime = substr($line, 36,6);
$new_destination = preg_replace('/\s+/', '', $destination);
$new_dest = preg_replace('/\s+/', '', $dest);
if ($vessel == "Commodore Go "){$vessel="Commodore Goodwill";}
if ($vessel == "Condor Vites "){$vessel="Condor Vitesse";}
if ($vessel == "Commodore Cl "){$vessel="Commodore Clipper";}
if ($vessel == "Huelin Dispa "){$vessel="Huelin Dispatch";}
if ($vessel == "Condor Expre "){$vessel="Condor Express";}
if ($destination == "Jersey/St Ma "){$destination="Jersey/St Malo";}
if ($actualtime == " E"){$actualtime=" ";}
$new_destination = strtoupper($new_destination);
$tomorrow = 0;
if ($vessel == "Guernsey Harb"){
echo "<tr><td class=cinema align=left><FONT SIZE=1 FACE=Verdana, Arial, Helvetica, sans-serif><b>Vessel</b></font></td><td class=cinema align=left><FONT SIZE=1 FACE=Verdana, Arial, Helvetica, sans-serif><b>From</b></font></td><td class=cinema align=left><FONT SIZE=1 FACE=Verdana, Arial, Helvetica, sans-serif><b>Time</b></font></td><td class=cinema align=left><FONT SIZE=1 FACE=Verdana, Arial, Helvetica, sans-serif><b>Arrived</b></font></td></tr>";
$tomorrow = 1;}
else if ($destination == "rrow's Arriva")
{
echo "<tr><td colspan=4 class='sectionmenucell' valign=top align=left><font size=1 FACE=Verdana, Arial, Helvetica, sans-serif><b> Sailings scheduled for tomorrow</b></font></td></tr>";
$tomorrow = 2;
}
if ($dest == "" || $new_destination == $new_dest){
if ($tomorrow == 0){
echo "<tr><td valign=top align=left><font size=1 FACE=Verdana, Arial, Helvetica, sans-serif>$vessel </font></td><td valign=top align=left><font size=1 FACE=Verdana, Arial, Helvetica, sans-serif><b>$destination </b></font></td><td width=15% valign=top align=left><font size=1 FACE=Verdana, Arial, Helvetica, sans-serif>$duetime </font></td><td valign=top align=left><font size=1 FACE=Verdana, Arial, Helvetica, sans-serif>$actualtime </font></td></tr>";
}}
}
fclose($file);
echo "</table>";
?>
and
PHP Code:
<?php
//$file = fopen ("ftp/gsyhdep.txt", "r");
$file = fopen ("http://www.thisisguernsey.co.uk/thirdparty/gsyhdep.txt", "r");
if (!$file) {
echo "<p>Unable to open remote file.\n";
exit;
}
?>
<table cellpadding=0 width=440 cellspacing=5 align=center border=0>
<?php
while (!feof ($file)) {
$line = fgets ($file, 1024);
/* this only works if the title and its tags are on one line */
$vessel = substr($line, 2,13);
$destination = substr($line, 15,13);
$duetime = substr($line, 28,5);
$actualtime = substr($line, 36,5);
$new_destination = preg_replace('/\s+/', '', $destination);
$new_dest = preg_replace('/\s+/', '', $dest);
if ($vessel == "Commodore Go "){$vessel="Commodore Goodwill";}
if ($vessel == "Condor Vites "){$vessel="Condor Vitesse";}
if ($vessel == "Commodore Cl "){$vessel="Commodore Clipper";}
if ($vessel == "Huelin Dispa "){$vessel="Huelin Dispatch";}
if ($vessel == "Condor Expre "){$vessel="Condor Express";}
if ($destination == "Jersey/St Ma "){$destination="Jersey/St Malo";}
$new_destination = strtoupper($new_destination);
$tomorrow = 0;
if ($vessel == "Guernsey Harb"){
echo "<tr><td colspan=4 class='sectionmenucell' valign=top align=left><font size=1 FACE=Verdana, Arial, Helvetica, sans-serif><b> Sailings scheduled for today - $timestamp</b></font></td></tr>";
echo "<tr><td class=cinema align=left><FONT SIZE=1 FACE=Verdana, Arial, Helvetica, sans-serif><b>Vessel</b></font></td><td class=cinema align=left><FONT SIZE=1 FACE=Verdana, Arial, Helvetica, sans-serif><b>To</b></font></td><td class=cinema align=left><FONT SIZE=1 FACE=Verdana, Arial, Helvetica, sans-serif><b>Time</b></font></td><td class=cinema align=left><FONT SIZE=1 FACE=Verdana, Arial, Helvetica, sans-serif><b>Departed</b></font></td></tr>";
$tomorrow = 1;}
else if ($destination == "rrow's Depart")
{
echo "<tr><td colspan=4 class='sectionmenucell' valign=top align=left><font size=1 FACE=Verdana, Arial, Helvetica, sans-serif><b> Sailings scheduled for tomorrow</b></font></td></tr>";
$tomorrow = 2;
}
if ($dest == "" || $new_destination == $new_dest){
if ($tomorrow == 0){
echo "<tr><td valign=top align=left><font size=1 FACE=Verdana, Arial, Helvetica, sans-serif>$vessel </font></td><td valign=top align=left><font size=1 FACE=Verdana, Arial, Helvetica, sans-serif><b>$destination </b></font></td><td width=15% valign=top align=left><font size=1 FACE=Verdana, Arial, Helvetica, sans-serif>$duetime </font></td><td valign=top align=left><font size=1 FACE=Verdana, Arial, Helvetica, sans-serif>$actualtime </font></td></tr>";
}}
}
fclose($file);
echo "</table>";
?>
Bookmarks