I want to add pagination to this.
PHP Code:<?
$dh = opendir( $dir );
while( $filename = readdir( $dh ) ) {
$filepath = $dir.$filename;
if( is_file( $filepath ) and ereg( "\.jpg$", $filename ) || ereg( "\.gif$", $filename ) || ereg( "\.png$", $filename ) ) {
$gallery[] = $filepath;
}
function DateCmp($a, $b) {
if($a[1]==$b[1]) return 0;
else return ($a[1] < $b[1]) ? -1 : 1;
}
function SortByDate(&$Files) {
usort($Files, 'DateCmp');
}
SortByDate(array_reverse($gallery));
foreach( $gallery as $image ) {
echo "<li><a href='$image'><img src='$image' alt='$cat$count' /></a></li>";
}
?>
Thanks!







Bookmarks