I'm trying to add some extra navigation to our website's photo galleries. Currently from the gallery page users simply go into photos and back out to the gallery again. I would like to build in next and previous links, but can't work out how to do this without a complete rebuild of the galleries.
Here's the coding for the gallery page:
and the photo viewing page:
// The Gallery of Images
$dirname = "images/hostschemesm/";
$images = scandir($dirname);
$ignore = Array(".", "..", ".htaccess");
foreach($images as $curimg)
if (!in_array($curimg, $ignore))
echo "<a href='view1.php?img=$curimg'><img src='images/hostschemesm/$curimg' title='$curimg' alt='$curimg' width='200' height='134' /></a>";
I'm thinking it possible to just edit the photo viewing page to scandir($dirname) to be able to create a list of contents again, but I don't have the PHP skills to write this myself yet. I'm hoping to be able to either make it loop around (last photo links to first again) or preferably have the buttons disappear if there is no link in that direction.
// View an Image
echo "<a href='1.php'><img src='images/hostschemelg/$curimg' title='$curimg' alt='$curimg' width='744' /></a>";
Any help would be appreciated and if you can explain to me how things work too that would be AMAZING!!