php-paginator分页处理类
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | <?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' ;
public function __construct($totalItems, $itemsPerPage, $currentPage, $urlPattern = '' )
{
$ this ->totalItems = $totalItems;
$ this ->itemsPerPage = $itemsPerPage;
$ this ->currentPage = $currentPage;
$ this ->urlPattern = $urlPattern;
$ this ->updateNumPages();
}
|
函数1:根据总页数,当前页,和页分组及url产生分页导航,分页函数参数列表(有多少页,当前页,每页多少个 ,链接地址)。函数2:根据记录数,页列清数,$page,当前页;$row_num记录总数;$pagesize:每页记录数;$url记录页。
免责声明
本站所有资源均由网友贡献或各大下载网站转载。请自行检查软件的完整性!本站所有资源仅供学习参考。请不要将它们用于商业目的。否则,一切后果由您负责!如有侵权,请联系我们删除。联系方式:admin@php.cn