Example #1
0
$page = filter_input(INPUT_GET, 'page');
//curent page. may be generated from form data.
$size = '5';
//number of items per page.
$pagesNumber = '10';
//total pages to show.
//instanciate pagination class
$pagination = new Pagination($itemsList, $page, $size, $pagesNumber);
//set custom skip text
$pagination->setSkip('<>');
//get pages count
$pages = $pagination->getPages();
//get pages list
$pagesList = $pagination->getPagesList();
//get items for the page
$items = $pagination->getPageItemsList();
//get next and previous pages
$next = $pagination->getNext();
$previous = $pagination->getPrevious();
?>
<html>
    <head>
        <title>Pagination example</title>
    </head>
    <body>
        <div>
            <!--print total page count -->
            The total page count is: <?php 
print $pages;
?>
        </div>