pagination using an array
Posted: Mon Apr 30, 2007 9:17 pm
I'm trying to do pagination for a gallery. I'm using an array from a glob function. What I want to do is to start the array further along if you're displaying a page further along. I also only want to display 10, 20, 30, etc.. results. I can't seem to figure out how to do it.
Code: Select all
$result = glob("/home/guttersg/www/images/clothing/sold/th_*.jpg");
foreach ($result as $filename) {
echo "<td align=\"center\">\n";
preg_match('#^.*?_(\d+)\.(jpg|png)$#',$filename,$match);
echo "<A HREF=\"javascript:popUp('http://www.guttersgoods.com/gallery.php?ProductID=".$match[1]."')\"><img border=0 class=galleryimg width=112px height=150px src=\"/images/clothing/sold/".basename($filename)."\"></a>\n";
echo "</td>\n";
if ($i == 4){
echo "</tr>\n<tr>\n";
$i = 1;
}else{
$i++;
}
}