|
Posted by matt on 11/17/31 11:34
I have this bit of code, that isn't valid, and I need some help getting
it to work... Currently, I get an error because I am calling the next()
function within a foreach loop. I am opening a flat file with data in
the format of:
01|data1|data2
01 Being Gallery Name, data1 being the filename, data2 being photo caption.
Basically I need to look at the line from the text file, and if the
first 2 digits do not match the gallery I have specified, then move on
to the next line, completely ignoring the first line... Code follows:
I would appreciate any help...
<?
$gallery = 03;
$data = file('gallery.txt');
echo "<table border=0 width=500 align=center>";
foreach ($data as $line)
{
list ($g, $q, $a) = explode('|' , trim($line) );
if ( $g != $gallery ) next($line);
else
{
echo "<td width=50% valign=top><img src='/gallery/$q' width=220><br>";
echo "$a<br>";
echo "<a href=\"/gallery/$q\">Enlarge</a><br><br></td>";
$ee++;
//2 - row
if($ee%2==0) echo "<tr>";
}
echo "</table>";
}
?>
[Back to original message]
|