Imitation dedecms drop-down page style modified thinkphp pagination class instance, dedecmsthinkphp
This article describes the thinkphp pagination class modified by The Imitation Dede drop-down page style. Share to everyone for your reference. The implementation method is as follows:
Modify thinkphp Pagination Class: drop-down list page (similar to Dedecms page):
Plain HTML code:
Copy the Code code as follows:12
To modify the page class operation:
Page.class.php page, related parts of the original code:
Copy the Code code 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:
Copy the Code code 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. = "";
The page effect looks like this:
It is hoped that this article is helpful to everyone's thinkphp program design.
How to change page paging, thinkphp kernel, examples such as: http://wwwttplmgcom/special/8html
Use the Setconfig method in the pagination class to customize the page-out style:
I have a previously used custom paging class, you see this change.
/** * * Enter Public Paging class * @param array $map page filter conditions * @param class $Form Data Model * @param number of bars displayed in integer $limit page * @param string $ Order sort * @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 Paging Class $count = $Form->where ($map)->count ();//query satisfies the required total number of records $page = new page ($count, $limit);//Instantiate paging class Number of incoming total records and number of records displayed per page $page->rollpage=3; $Page->setconfig (' theme ', "%uppage%%linkpage%%downpage%
%nowpage%/%totalpage% page </a></li> "), $res [' page '] = $Page->show ();//pagination display output return $res; }
thinkphp How does the style of pagination change and where does it change? Answer
You can use a few more data to multiple pages, and then look at the source code to see the pagination code of CSS plus a stylesheet is OK
div.meneame{padding:3px;font-size:80%;margin:3px ; color: #ff6500; text-align:center;} Div.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;} Div.meneame a:hover{border: #ff9600 1px solid;background-image:none;color: #ff6500; Background-color: #ffc794;} Div.meneame a:active{border: #ff9600 1px solid;background-image:none;color: #ff6500; Background-color: #ffc794;} Div.meneame span.current{border: #ff6500 1px solid;padding:5px 7px;font-weight:bold;color: #ff6500; margin:0 3px 0 0;background-color: #ffbe94;} Div.meneame span.disabled{border: #ffe3c6 1px solid;padding:5px 7px;color: #ffe3c6; margin:0 3px 0 0;}
http://www.bkjia.com/PHPjc/903486.html www.bkjia.com true http://www.bkjia.com/PHPjc/903486.html techarticle Imitation dedecms drop-down page style modified thinkphp pagination class instance, dedecmsthinkphp This article describes the thinkphp pagination class modified by The Imitation Dede drop-down page style. Share to everyone for your reference ...