<?php
namespace JasonGrimes;
class Paginator
{
const NUM_PLACEHOLDER = '(:num)';
protected $totalItems;
protected $numPages;
protected $itemsPerPage;
protected $currentPage;
protected $urlPattern;
protected $maxPagesToShow = 10;
protected $previousText = 'Previous';
protected $nextText = 'Next';
/**
* @param int $totalItems The total number of items.
* @param int $itemsPerPage The number of items per page.
* @param int $currentPage The current page number.
* @param string $urlPattern A URL for each page, with (:num) as a placeholder for the page number. Ex. '/foo/page/(:num)'
*/
public function __construct($totalItems, $itemsPerPage, $currentPage, $urlPattern = '')
{
$this->totalItems = $totalItems;
$this->itemsPerPage = $itemsPerPage;
$this->currentPage = $currentPage;
$this->urlPattern = $urlPattern;
$this->updateNumPages();
}Function 1: Generate paging navigation and paging function parameter list based on the total number of pages, current page, page grouping and url (how many pages, current page, how many per page, link address). Function 2: According to the number of records, page columns are counted, $page, current page; $row_num total number of records; $pagesize: number of records per page; $url record page.
Pagination library97922017-12-23
Pagination library74802017-12-04
Pagination is dividing a page into two or more pages. There is an automatic paging mechanism that can divide the content in a mobile Web Form into a group of smaller pages for rendering, suitable for a specific device. This mechanism also renders user interface elements that can be used to navigate to other pages.
Pagination library97532017-11-30
PHP implements paging class
Pagination library57682017-11-16
Paging class implemented by php
Pagination library50922017-11-04
The perfect php paging class, especially easy to use, friends who need to use php paging class should not miss it.
Pagination library70382017-10-25
Code introduction: Practical PHP paging class, especially easy to use, friends who need to use PHP paging class should not miss it.
Pagination library60332017-06-26
Code introduction: The universal PHP paging class is particularly easy to use. Friends who need to use PHP paging class should not miss it.
Pagination library75362017-06-25
Introduction: A native PHP paging class, the paging style is somewhat similar to bootstrap, simple and beautiful, free download
Pagination library72522017-06-23
IntroductionA simple and easy-to-use PHP paging code, The total number of records in the data table, The number of rows displayed on each page, determine the page number. Friends in need can download it for reference.
Pagination library57342017-06-17
Share a encapsulated php mysql paging class, displays the data in the MySQL database in paging, according to the SQL query statement The corresponding records are read from the table, and displays the first page, next page, previous page, and next page.
Pagination library61942017-06-01
Introduce a simple PHP paging function class, get the total number of information, call the paging function, Database operation, Output paging navigation content.
Pagination library55362017-04-13