Hello , I have here a small image gallery scrip that displays one image per page now I want 4 images per page. I dont know how to do the loop for this. Here is the display code
<?
// photo display
if (!isset($gal) or trim($gal)=='') {
$gal = 1; }
if (!isset($pic) or trim($pic)=='') {
$pic = 1; }
$dir= "gallery".$gal;
@$d = dir($dir);
if ($d) {
while($entry=$d->read()) {
$entry = preg_replace("/ /","%20",$entry);
$pos = strpos (strtolower($entry), ".jpg");
if (!($pos === false)) {
$arr_pic[] = $dir."/".$entry; } }
$d->close(); }
@sort ($arr_pic);
$total = sizeof($arr_pic);
echo "<a href=".$arr_pic[$pic-1]."><img src=".$arr_pic[$pic-1]." border=1 width=380 height=380>";
?>
As you can see its very simple but when it comes to adding more I have no clue how to, or even how to make the loop for it. Also if someone does help me edit this I have links at the bottom to skip ahead by 10 pages or so and also links for "next page" I would have to have them all recoded also. Heres the links code
// navigation display
if ( $pic<2) {
$prev_url="?gal=".$gal."&pic=1";
} else {
$prev_url='?gal='.$gal.'&pic='.($pic-1); }
if ( $pic+1>$total) {
$next_url="?gal=".$gal."&pic=".$pic;
} else {
$next_url='?gal='.$gal.'&pic='.($pic+1); }
if ( $pic-10<1) {
$skip_back_url='?gal='.$gal.'&pic=1';
} else {
$skip_back_url='?gal='.$gal.'&pic='.($pic-10); }
if ( $pic+10>$total) {
$skip_url='?gal='.$gal.'&pic='.$total;
} else {
$skip_url='?gal='.$gal.'&pic='.($pic+10); }
echo "<a href=".$skip_back_url.">Skip 10</a> | ";
echo "<a href=".$prev_url.">Prev</a> | ";
echo $pic." of ".$total." | ";
echo "<a href=".$next_url.">Next</a> | ";
echo "<a href=".$skip_url.">Skip 10</a>";
?>
Anyway if anyone can help me display 4 images per page and update the links id be very happy. Thanks