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