PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of 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: 11 years ago
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(101, 5, $_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();
?>

For more information send a message to info at phpclasses dot org.