PHP Array Pagination

if ($dh = opendir($path)) {
while (($file = readdir($dh)) !== false) {
if($file!=".." && $file!="." && strtolower($file)!="thumbs.db")
// Include the pagination class
include 'pagination.class.php';
// Create the pagination object
$pagination = new pagination;
// If we have an array with items if (count($arrayPhotos)) { // Parse through the pagination class $imagePages = $pagination->generate($arrayPhotos, 10); // If we have items if (count($imagePages) != 0) { echo "<table>"; // Create the page numbers echo $pageNumbers = '<tr><td colspan=5 class="numbers">'.$pagination->links().'</td></tr>'; // Loop through all the items in the array echo "<tr>"; $counter=0; foreach ($imagePages as $singleImage) { if(($counter++)%5==0) echo "</tr><tr>"; // Show the information about the item echo '<td><img src="images/'.$singleImage.'" border="0" style="padding:5px;" width="150" height="200" /></td>'; } echo "</tr>"; // print out the page numbers beneath the results echo '<tr><td colspan=5 class="numbers">'.$pageNumbers.'</td></tr>'; } }

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Posts

Begin typing your search term above and press enter to search. Press ESC to cancel.

Back To Top