Login   Register  
PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Kai Ming Choi  >  Page Control Class  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: example
Class: Page Control Class
Generate links to browse listings split in pages
Author: By
Last change:
Date: 2010-09-23 08:27
Size: 1,113 bytes
 

Contents

Class file image Download
<?php
// Page Control Class Example
require "pagecontrol.class.php";

// PageControl(total number of entries, entries show in each page, current page)
$pagecon = new PageControl(1015$_GET['page']);

//Print a list of pages
echo $pagecon->getList(array(
    
'link'    =>    "<a href='?page=#PAGE#'>#PAGE#</a> ",    //the link of each page, #PAGE# is the page number
    
'current'    =>    "<b>[#PAGE#]</b> ",    //how the current page is showed
    
'neighbor'    =>    3,    //how many pages next to the current page will be shown
    
'headfoot'    =>    true,    //show the first and the last page number
    
'skipped'    =>    "... ",    //what replaces the skipped pages replace
    
'previous'    =>    "<a href='?page=#PAGE#'>Previous</a> ",    //show the "previous" button, #PAGE# is the page number
    
'next'    =>    "<a href='?page=#PAGE#'>Next</a>"    //show the "next" button, #PAGE# is the page number
));

echo 
"<br />";

//the number of the first entry of the current page
//same as $pagecon->from
echo $pagecon->getEntryFrom();

echo 
"<br />";

//the number of the last entry of the current page
//same as $pagecon->to
echo $pagecon->getEntryTo();
?>