It sounds like I do exactly what you are after on my site. This example takes a few assumptions:
- $getsection is passed in via a url.
- The file format is photosection|thumbnail|image format.
- That you can include the <tr> breaks when you want them via a counter.
- The thumbnail and image entries in the file include any path information required.
- You add the table and tr tags (I haven't included them).
$photofile = file( "photofilelist.txt" );
foreach ($photofile as $photoline )
{
$photodata = explode( "|", $photoline );
$photosection = $photodata[0];
$photothumb = $phototdata[1];
$photoimage = $photodata[2];
if ( $getsection == $photosection )
{
print '<td><a href="'.$photoimage.'"><img src="'.$photothumb.'"></a></td>';
}
}
That should basically do you. You can include all sorts of other information in the file (e.g. file size, alt, etc..) if you want it.
I have used it to allow me to include a picture search so that people can search for specific pictures.
You can see it at www.demoncheese.co.uk and then choose the events option at the top (though I still have a few table bugs to sort out in Netscape).