Thinkphp paging class instance that is similar to dedecms drop-down paging style modification. dedecmsthinkphp_PHP tutorial

Source: Internet
Author: User
Dedecmsthinkphp is a thinkphp paging instance that imitates the dedecms drop-down paging style modification. The thinkphp paging class is a thinkphp paging class that imitates the dedecms drop-down paging style modification. the dedecmsthinkphp example in this article describes the thinkphp paging class that imitates the dede drop-down paging style modification. For your reference, dedecmsthinkphp paging class instance, which is similar to the dedecms drop-down paging style modification

This example describes the thinkphp paging class modified by the dede drop-down paging style. Share it with you for your reference. The specific implementation method is as follows:

Modify the thinkphp paging class: the following pull paging (similar to dedecms paging ):

Pure html code:

The code is as follows:

12

Modify Page operations:

Page. class. php Page, the relevant original code:

The code is as follows:

$ LinkPage = "";
For ($ I = 1; $ I <= $ this-> rollPage; $ I ++ ){
$ Page = ($ nowCoolPage-1) * $ this-> rollPage + $ I;
If ($ page! = $ This-> nowPage ){
If ($ page <= $ this-> totalPages ){
$ LinkPage. = "". $ page ."";
} Else {
Break;
}
} Else {
If ($ this-> totalPages! = 1 ){
$ LinkPage. = "". $ page ."";
}
}
}

After modification:

The code is as follows:

$ LinkPage ="";For ($ I = 1; $ I <= $ this-> rollPage; $ I ++ ){$ Page = ($ nowCoolPage-1) * $ this-> rollPage + $ I;If ($ page! = $ This-> nowPage ){If ($ page <= $ this-> totalPages ){$ LinkPage. ="". $ Page ."";} Else {Break;}} Else {If ($ this-> totalPages! = 1 ){$ LinkPage. ="". $ Page ."";}}}$ LinkPage. ="";

Shows the page effect:

I hope this article will help you with ThinkPHP programming.


How to change the page pages and THINKPHP kernel, for example, http: // wwwttplmgcom/special/8 html

Use the setConfig method in the paging class to customize the paging style:
I have a previously used custom paging class. let's change it.

/***** Enter public paging class * @ param array $ map paging filter condition * @ param class $ Form data model * @ param integer $ number of lines displayed on the limit page * @ param string $ order sorting * @ return array */public function _ list ($ map, $ Form, $ limit = 9, $ order = 'add _ time') {$ res = array (); $ p = empty ($ _ GET ['P'])? 0: (int) $ _ GET ['P']; $ res ['list'] = $ Form-> field (true)-> where ($ map) -> order ($ order)-> page ($ p. ','. $ limit)-> select (); import ('org. util. page '); // import the paging class $ count = $ Form-> where ($ map)-> count (); // query the total number of records meeting the requirements $ Page = new Page ($ count, $ limit ); // The total number of incoming records and the number of records displayed on each Page in the instantiated paging class $ Page-> rollPage = 3; $ Page-> setConfig ('theme ', "% upPage % linkPage % downPage %

  • % NowPage %/% totalPage % page </a> </li> "); $ res ['Page'] = $ Page-> show (); // return $ res ;}

    How does thinkphp paging style change? Answer

    You can use a few more data pages and view the source code to view the css of the paging code and add a style sheet.
    P. meneame {padding: 3px; font-size: 80%; margin: 3px; color: # ff6500; text-align: center;} p. meneame a {border: # ff9600 1px solid; padding: 5px 7px; background-position: 50% bottom; background-image: url (.. /images/meneame.jpg); margin: 0 3px 0 0; text-decoration: none;} p. meneame a: hover {border: # ff9600 1px solid; background-image: none; color: # ff6500; background-color: # ffc794;} p. meneame a: active {border: # ff9600 1px solid; background-image: none; color: # ff6500; background-color: # ffc794;} p. meneame span. current {border: # ff6500 1px solid; padding: 5px 7px; font-weight: bold; color: # ff6500; margin: 0 3px 0 0; background-color: # ffbe94 ;} p. meneame span. disabled {border: # ffe3c6 1px solid; padding: 5px 7px; color: # ffe3c6; margin: 0 3px 0 0 ;}

    Examples in this article describe the thinkphp paging class that imitates the dede drop-down paging style modification. Share it with you for your reference...

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