I'm reading lines from a file to display an image. Each image and
caption is on a new line. I read the string from each line, up until the
line break (\r\n) and then assume my fields are starting again on the
new line. It all works fine, except for the whole thing to work
properly, i need a line break on the last line of the file, causing the
image display to show a broken image... is it possible to ignore a line
if it has nothing in it.. something like an if null statement or
something?????
Here's the bit of the file that spits out the contents of the file...
the file is in format "filename.jpg|c aption of file" (without the quotes)
thanks
<?
$data = file($file);
foreach ($f as $o)
{
print "<input type=radio name=line value=$o>";
$g = $o;
list ($q, $a) = explode('|' , trim($g) );
echo "<img src='images/$q' height=100><br> <br>";
}
?>
caption is on a new line. I read the string from each line, up until the
line break (\r\n) and then assume my fields are starting again on the
new line. It all works fine, except for the whole thing to work
properly, i need a line break on the last line of the file, causing the
image display to show a broken image... is it possible to ignore a line
if it has nothing in it.. something like an if null statement or
something?????
Here's the bit of the file that spits out the contents of the file...
the file is in format "filename.jpg|c aption of file" (without the quotes)
thanks
<?
$data = file($file);
foreach ($f as $o)
{
print "<input type=radio name=line value=$o>";
$g = $o;
list ($q, $a) = explode('|' , trim($g) );
echo "<img src='images/$q' height=100><br> <br>";
}
?>
Comment