Okay, so I need to be able to read the contents of a directory (in this case, images), and then print out the results of that in alphabetical order with only 50 items per page, so that people can page through the results. Here's what I've got so far:
$handle = opendir($direktori);
while ($file = readdir($handle))
{
$filelist[] = $file;
}
asort($filelist);
$temcount = 1;
while (list ($key, $file) = each ($filelist))
{
if (ereg(".png|.gif|.jpg",$file))
{
if ($file == "." || $file == "..") {
$a=1;
} else {
echo "<td width=\"80\"><img src=\"/images/$file\" alt=\"$file\"></td>";
}
//print them out, 6 to a row
if ($temcount == 6) {
echo "</tr><tr>";
$temcount -= 6;
}
$temcount ++;
}
}
My problem is, I don't have a clue how to make it print out only 50 to a page. I suspect there's a for loop involved, but beyond that, I'm clueless. Any help or suggestions would be hugely appreciated...