thinkphp example Analysis of _php instances in page usage

Source: Internet
Author: User
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.

  • Related Article

    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.