|
Posted by Joker7 on 11/12/05 15:45
Hi One and all,
I'm banging my head against a wall here ....I'm using the code below to
display the contents of a text file... but some times the file is not
available,so I need to display an alternative that is not in the same format
just some html.Is there a nice and easy way to do this and how?
Cheers
Chris
<?php
ini_set('default_socket_timeout', 8);
$file = @file("/joker7");
if ($file === false)
{
echo "<p>could not read file</p>\n";
}
else
{
array_shift($file);
$tracks = array();
for ($i = 0, $x = count($file); $i < $x; $i+=2)
{
$track['title'] = rtrim($file[$i]);
$track['date'] = rtrim($file[$i+1]);
array_push($tracks, $track);
}
echo "\n";
foreach ($tracks as $track)
{
printf("\t<font face=Verdana size=1 color=#6699CC><b><a
href=http://r/Joker7/>\n\t\t%s</a></b></font><br><font face=Times New Roman
size=1 color=#72609F><i>%s<br>\n\t</i></font>\n",
$track['title'],
$track['date']
);
}
echo "\n";
}
?>
--
Cheap As Chips Broadband http://yeah.kick-butt.co.uk
Navigation:
[Reply to this message]
|