修改thinkphp分页类:如下拉列表式分页(类似dedecms分页):
纯html代码:
<select name="sldd" style="width:36px" onchange="location.href=this.options[this.selectedIndex].value;">
<option value="http://URL/1">1</option>
<option value="http://URL/2" selected="selected">2</option>
</select>
修改Page类操作:
Page.class.php
原代码:
$linkPage="";
for($i=1;$i<=$this->rollPage;$i++){
$page=($nowCoolPage-1)*$this->rollPage+$i;
if($page!=$this->nowPage){
if($page<=$this->totalPages){
$linkPage .= " <a href='".$url."&".$p."=$page'> ".$page." </a>";
}else{
break;
}
}else{
if($this->totalPages != 1){
$linkPage .= " <span class='current'>".$page."</span>";
}
}
}
修改后:
$linkPage=" <select name='sldd' style='width:36px' onchange='location.href=this.options[this.selectedIndex].value;'>";
for($i=1;$i<=$this->rollPage;$i++){
$page=($nowCoolPage-1)*$this->rollPage+$i;
if($page!=$this->nowPage){
if($page<=$this->totalPages){
$linkPage .= "<option value='".$url."&".$p."=$page'>".$page."</option>";
}else{
break;
}
}else{
if($this->totalPages != 1){
$linkPage .= "<option value='".$url."' selected='selected'>".$page."</option>";
}
}
}
$linkPage.="</select>";
页面效果: