mlowe.space12
New Member
- Messages
- 5
- Reaction score
- 0
- Points
- 1
I got this pagination thing from this forum but there are a few errors. it comes up with First | Last | Last | Last | Last | Last | and i need it to display in 2 columns
here is the code:
PHP Code:
here is the code:
PHP Code:
PHP:
<?php
if(!$_GET['start']) {
$start = 0;
} else {
$start = $_GET['start'];
}
$exclude_files = array("");
$ifiles = Array();
$handle = opendir('upload/');
$number_to_display = '10';
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." && !in_array($file, $exclude_files)) {
$ifiles[] = $file;
}
}
closedir($handle);
$total_files = count($ifiles);
$req_pages = ceil($total_files/$number_to_display);
echo "Total Images = ". $total_files."<br>";
for($z=0; $z<$number_to_display; $z++) {
$vf = $z+$start;
$ifiles_display = explode(".", $ifiles[$vf]);
echo "<img width=200 height=200 src =upload/" . $ifiles[$vf]. "></img>";
echo '<br>';
}
echo "<a href=\"?start=0\">First</a> |";
for($x=1; $x<$req_pages; $x++) { ?>
<a href="?start=<?php echo ($x)*$number_to_display; ?>">Last</a> |
<?php } ?>