Example #1
0
 static function paginate($total, $limit = 10, $link = "", $current = -1, $range = 5)
 {
     $pages = new Pagination($total, $limit);
     $pages->setTemplate('parter/pagination.html');
     if (!empty($link)) {
         $pages->setLinkPath($link);
     }
     if ($current != -1) {
         $pages->setCurrent($current);
     }
     $pages->setRange($range);
     return $pages->serve();
 }
Example #2
0
<?php

include "./pagination.php";
$iLimit = 10;
$iPage = isset($_GET['page']) ? $_GET['page'] : 1;
$iStart = $iLimit * $iPage - $iLimit;
$oPaginate = new Pagination();
$aNames = $oPaginate->getNames($iStart, $iLimit);
$oPaginate->setCount($aNames['count']);
$oPaginate->setRange(3);
$oPaginate->setLimit($iLimit);
$oPaginate->setCurrentPage($iPage);
if ($aNames['count'] > 0) {
    foreach ($aNames['names'] as $r) {
        echo $r['name'] . '<br>';
    }
}
echo $oPaginate->create();