thinkphp simple, beautiful, reliable page-type

Source: Internet
Author: User


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


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.