PHP Classes

File: ex_pagination

Recommend this page to a friend!
  Classes of Danny Tucker   EZ Framework   ex_pagination   Download  
File: ex_pagination
Role: Example script
Content type: text/plain
Description: Example
Class: EZ Framework
Framework providing several types of functionality
Author: By
Last change:
Date: 18 years ago
Size: 1,080 bytes
 

Contents

Class file image Download
<?php
# Version 1.0
require_once('../include/config.inc.php');

// Number of results per page, the variable to be used in the URL to pagenate
$pag = new pagination(20,'page');

// Get the total number of results
$sql->go("SELECT pic_id FROM {$_T['PHOTO']}");
$pag->set_total( $sql->numRows( ) );

// Get the data
// Don't forget the function at the end of the query!
$sql->go("SELECT * FROM {$_T['PHOTO']} WHERE pic_cat = '{$catid}'".$pag->limit_query());
$photo_data = $sql->fetchAll();

// Show the previous link, last param is what to use and to show the link, can be an image if you wish
echo $pag->show_prev('<a href="'.$_SERVER['PHP_SELF']."?cat=$catid&",'<img src="arrow_back.gif">');
// Show the page numbers, last param is the amount of pages to show for the current page both directions
echo $pag->show_list('<a href="'.$_SERVER['PHP_SELF']."?cat=$catid&",10);
// Show the next link, last param is what to use and to show the link, can be an image if you wish
echo $pag->show_next('<a href="'.$_SERVER['PHP_SELF']."?cat=$catid&",'Next');




?>