This is a example on how to write a simple pagination class in php.
Instantiation of the pagination
$pagination = new Pagination();
Define the pagination properties
$pagination->setCurrentPage(4); //The current page
$pagination->setTotalPages(10); //The total number of pages
$pagination->setBoundaries(2); //The number of links at the beginning and at the end of the pagination
$pagination->setAround(3); //The number of links before and after the current page
Render the pagination
$pagination->render();
root /
|index.php
|--- lib/
|--- includes.php
|--- config.php
|--- pagination.php
|--- css/
|--- fonts/
|--- js/
|--- img/
A Demo is currently available under the following urls:
http://demos.franciscobarrento.com/paginationphp
Please send feedback and opinions to [email protected]