Home >Backend Development >PHP Tutorial >Example of thinkphp paging class modified to imitate dedecms drop-down paging style, dedecmsthinkphp_PHP tutorial

Example of thinkphp paging class modified to imitate dedecms drop-down paging style, dedecmsthinkphp_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:15:36999browse

An example of thinkphp paging class modified to imitate dedecms drop-down paging style, dedecmsthinkphp

The example in this article describes the thinkphp paging class modified to imitate the dede drop-down paging style. Share it with everyone for your reference. The specific implementation method is as follows:

Modify thinkphp paging class: such as drop-down list paging (similar to dedecms paging):

Pure html code:

Copy code The code is as follows:

Modify Page class operations:

Page.class.php page, relevant part of the original code:

Copy 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:

Copy code The code is as follows:
$linkPage=" ";

The page effect is as shown below:

I hope this article will be helpful to everyone’s ThinkPHP programming design.

How to change web page paging, THINKPHP core, for example: http://wwwttplmgcom/special/8html

Use the setConfig method in the paging class to customize the paging style:
I have a custom paging class that I used before. You can change it here.

/** * * Enter public paging class* @param array $map paging filtering conditions* @param class $Form data model* @param integer $limit number of items displayed in paging* @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 paging class $count = $Form->where($map)-> ;count();// Query the total number of records that meet the requirements $Page = new Page($count,$limit);// Instantiate the paging class and pass in the total number of records and the number of records displayed on each page $Page-> rollPage=3;$Page->setConfig('theme'," %upPage% %linkPage% %downPage%

  • %nowPage%/%totalPage% page
  • ");$res['page'] = $Page->show();// Display output in paging return $res; }

    How to change the style of thinkphp pagination and where to change it? Answer

    You can use more data to divide into several pages, and then check the source code to see the css of the paging code. Add a style sheet and it will be 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;}

    www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/903486.htmlTechArticleAn example of thinkphp paging class modified to imitate dedecms drop-down paging style, dedecmsthinkphp This article describes an example of imitating dede drop-down paging style modification thinkphp pagination class. Share it with everyone for your reference...
    Statement:
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn