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...