PHP code example of noroman / pagination
1. Go to this page and download the library: Download noroman/pagination library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
noroman / pagination example snippets
use Pagination\Templates\Hellip;
use Pagination\Templates\Simple;
$currentPage = 9;
$total = 200;
$url = '/news/articles/2017/';
/* template Hellip ------------------------------------------------------------------- */
/* 1 … 5 6 <7> 8 9 … 21 */
$pagen = new Hellip($url);
$pagen->setTotal($total)->setCurrentPage($currentPage);
// $pagen->setPageSize(10); // the default
// $pagen->setMiddlePages(5); // the default
echo $pagen->getHtml();
echo '<hr>';
/* template Simple ------------------------------------------------------------------- */
/* « 2 3 4 5 6 » */
$pagen = new Simple($url);
$pagen->setTotal($total)->setCurrentPage($currentPage);
// $pagen->setPageSize(10); // the default
// $pagen->setMiddlePages(5); // the default
echo $pagen->getHtml();
echo '<hr>';