No more nonsense. First preview of the above, that is, the page of the blog;
This paging class is modified on the basis of the page-class built into the thinkphp framework;
Some of the design of the original paging class, in the actual use of the feeling is not very convenient;
1: Only one page content does not show the paging;
2: The original pagination class when the current page is the first and last page, do not display the first page and the last page of the button;
3: Less than a few pages do not show the home page and last button;
4: Parcel page content of the parent Div has no class;
According to the above problems are modified to be as follows;
1: If no data does not show pagination, if there is a page and above content is displayed paging;
2: The default is to display the first and last page buttons, but when the current page is the first and last page of the button click No effect;
3: The default on the display first and last button;
4: Add a class named page to the parent div for the wrapped page content;
5: Show the total number of content detected;
Sample environment: thinkphp3.2.3;
Page-Class Catalog:/thinkphp/library/org/bjy/page.class.php
The paging class code is as follows:
<?php// +----------------------------------------------------------------------// | thinkphp &NBSP;[&NBSP;WE&NBSP;CAN&NBSP;DO&NBSP;IT&NBSP;JUST&NBSP;THINK&NBSP;IT&NBSP]// +------------------------- ---------------------------------------------// | copyright (c) 2006-2014 http://
Thinkphp.cn all rights reserved. +----------------------------------------------------------------------// | licensed ( http://www.apache.org/licenses/LICENSE-2.0 )// +---------------------------------------------- ------------------------// | author: Miao Le <zuojiazi@vip.qq.com>
Page-Class invocation:
$count = $this->where ($where)->count ();
$page =new \org\bjy\page ($count, $limit);
$list = $this->where ($where)->order (' addtime desc ')->limit ($page->firstrow. '. $page->listrows)- >select ();
$show = $page->show ();
The use of the paging class is the same as the original thinkphp; specific reference: thinkphp Manual-Data paging