Examples of paging usage in thinkPHP, _ PHP Tutorial-php Tutorial

Source: Internet
Author: User
Analysis of paging usage instances in thinkPHP ,. Examples of paging usage in thinkPHP. This article describes the paging usage in thinkPHP. Share it with you for your reference. for example: take an instance for example. The action page: analyze the paging usage instance in publ thinkPHP,

This example describes the paging usage in thinkPHP. We will share this with you for your reference. The details are as follows:

Take an instance for example.

Action page:

Public function show () {import ("ORG. util. page "); // import the paging class $ news = D (" News "); $ count = $ news-> where (''content _ type' = '. $ id)-> count (); // total number of query records $ p = new Page ($ count, 10 ); $ list = $ contact-> where (''content _ type' = '. $ id)-> order ('sort ')-> limit ($ p-> firstRow. ','. $ p-> listRows)-> select (); $ p-> setConfig ('head', 'data record '); // You can customize the paging style $ p-> setConfig ('prev', "<"); $ p-> setConfig ('next', '> '); $ p-> setConfig ('first', '<'); $ p-> setConfig ('last', '> '); $ page = $ p-> show (); // the output variable of the navigation bar on the page $ this-> assign ("page", $ page ); // output pagination on the template page $ this-> assign ('info', $ list ); // The queried information is fed back to the template page $ this-> display ('index ');}

Called tpl page: index. php

Custom css styles, mainly used for paging styles


Loop output page information

........................................ ......

{$ Page}

The paging style is as follows:

You can customize the style as needed.

I hope this article will help you design php programs based on the thinkPHP framework.

Articles you may be interested in:
  • Use Ueditor rich text editor in ThinkPHP
  • ThinkPHP integration of Baidu Ueditor graphic tutorial
  • ThinkPHP automatic escape storage rich text editor content causes read error solution
  • Simple use of verification codes in thinkPHP
  • Usage of ueditor in thinkPHP

Example: This article describes the paging usage in thinkPHP. Share it with you for your reference, as shown in the following code: Take an instance for example, the action page: publ...

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.