This example describes the paging usage in thinkphp. Share to everyone for your reference, as follows:
Take an example.
Action page:
Public function Show () { import ("ORG. Util.page "); Import a paging class $news =d ("News"); $count = $news->where (' content_type ' = '. $id)->count (); The total number of entries in the query record $p = new Page ($count, ten); $list = $contact->where (' content_type ' = '. $id)->order (' sort ')->limit ($p->firstrow. ',' . $p->listrows)->select (); $p->setconfig (' header ', ' data '); The pagination style can be customized $p->setconfig (' prev ', "<"); $p->setconfig (' Next ', ' > '); $p->setconfig (' first ', ' << '); $p->setconfig (' Last ', ' >> '); $page = $p->show (); The output variable of the paging navigation bar $this->assign ("page", $page);//output pagination $this->assign (' info ', $list) on the template page; Query feedback to the template page $this->display (' Index ');}
TPL page called: index.php
Custom CSS styles, primarily for pagination styles
Cyclic output Paging information
.............................................. {$page}
The paging style is as follows:
Customize the style you want, as needed
It is hoped that this article is helpful to the PHP program design based on thinkphp framework.