search
HomePHP LibrariesPagination libraryphp-paginator paging processing class
php-paginator paging processing class
<?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.

Disclaimer

All resources on this site are contributed by netizens or reprinted by major download sites. Please check the integrity of the software yourself! All resources on this site are for learning reference only. Please do not use them for commercial purposes. Otherwise, you will be responsible for all consequences! If there is any infringement, please contact us to delete it. Contact information: admin@php.cn

Related Article

PHP paging class code, php paging code_PHP tutorialPHP paging class code, php paging code_PHP tutorial

13Jul2016

PHP pagination class code, php pagination code. PHP paging class code, php paging code Today I will give you a piece of code, this is a piece of PHP paging code: ?php //Create paging class class Page { private $_all_num; //Total number of data pr

PHP image processing class library and demonstration sharing, php image processing class library_PHP tutorialPHP image processing class library and demonstration sharing, php image processing class library_PHP tutorial

12Jul2016

PHP image processing class library and demonstration sharing, PHP image processing class library. PHP image processing class library and demonstration sharing, PHP image processing class library I simply wrote a PHP image processing class library. Although it has relatively few functions, it is not too advanced at present and will be used in the future.

Pagination class, php paging class_PHP tutorialPagination class, php paging class_PHP tutorial

13Jul2016

Pagination class, php paging class. Paging class, php paging class page.class.php 1 ? php 2 /* 3 * PHP paging class 4 * @package Page 5 * @Created 2013-03-27 6 * @Modify 2013-03-27 7 * @link http ://www.60ie.net 8 * Example: 9

PHP uses the Mysqli class library to achieve perfect paging effect, mysqli class library_PHP tutorialPHP uses the Mysqli class library to achieve perfect paging effect, mysqli class library_PHP tutorial

12Jul2016

PHP uses the Mysqli class library to achieve perfect paging effects, the mysqli class library. How PHP uses the Mysqli class library to achieve perfect paging effects, mysqli class library This article describes how PHP uses the Mysqli class library to achieve perfect paging effects. Share it with everyone for your reference.

PHP image processing class library and demonstration sharing_PHP tutorialPHP image processing class library and demonstration sharing_PHP tutorial

13Jul2016

PHP image processing class library and demonstration sharing. PHP image processing class library and demonstration sharing. I simply wrote a PHP image processing class library. Although it has relatively few functions, it is not used for too advanced ones at the moment. I will fill it in when I use it in the future, or someone.

PHP image processing class library MagickWand usage example analysis_PHP tutorialPHP image processing class library MagickWand usage example analysis_PHP tutorial

13Jul2016

Analysis of usage examples of PHP image processing library MagickWand. Example analysis of usage of PHP image processing class library MagickWand This article describes the usage of PHP image processing class library MagickWand. Share it with everyone for your reference. The specific analysis is as follows: MagickWand is

See all articles