- 控制的方式,这样我们能通过CSS自定义样式更方便融入不同的风格的模板中使用。
言归正传,下面教你怎么把DEDE搜索页的分页方式改成和列表页一样,通过LI控制
我们发现搜索模板里面的分页标签pagelist和普通的分页不一样,常见的分页控制代码是在include/arc.listview.class.php里面,而搜索页的分页是写在include/arc.searchview.class.php里面。因此需要修改这个文件。
打开
然后搜索 获取动态的分页列表
将获取动态的分页列表 一直到 //获得数字链接 之间的内容全部替换成下面代码
function GetPageListDM($list_len) { global $oldkeyword; $prepage=""; $nextpage=""; $prepagenum = $this->PageNo - 1; $nextpagenum = $this->PageNo + 1; if($list_len=="" || preg_match("/[^0-9]/", $list_len)) { $list_len=3; } $totalpage = ceil($this->TotalResult / $this->PageSize); if($totalpage<=1 && $this->TotalResult>0) { return "共1页/".$this->TotalResult."条记录"; } if($this->TotalResult == 0) { return "共0页/".$this->TotalResult."条记录"; } $purl = $this->GetCurUrl(); $oldkeyword = (empty($oldkeyword) ? $this->Keyword : $oldkeyword); //当结果超过限制时,重设结果页数 if($this->TotalResult > $this->SearchMaxRc) { $totalpage = ceil($this->SearchMaxRc/$this->PageSize); } $infos = " - 找到".$this->TotalResult."条记录/只显示{$totalpage}页 rn"; $geturl = "keyword=".urlencode($oldkeyword)."&searchtype=".$this->SearchType; $hidenform = "rn"; $geturl .= "&channeltype=".$this->ChannelType."&orderby=".$this->OrderBy; $hidenform .= "rn"; $hidenform .= "rn"; $geturl .= "&kwtype=".$this->KType."&pagesize=".$this->PageSize; $hidenform .= "rn"; $hidenform .= "rn"; $geturl .= "&typeid=".$this->TypeID."&TotalResult=".$this->TotalResult."&"; $hidenform .= "rn"; $hidenform .= "rn"; $purl .= "?".$geturl; //获得上一页和下一页的链接 if($this->PageNo != 1) { $prepage.="
- 上一页 rn"; $indexpage="
- 首页 rn"; } else { $indexpage="
- 首页 rn"; } if($this->PageNo!=$totalpage && $totalpage>1) { $nextpage.="
- 下一页 rn"; $endpage="
- 末页 rn"; } else { $endpage="
- 末页 rn"; } //获得数字链接
另外发现DEDECMS的搜索结果数量不受设置的 {dede:list perpage='10' titlelen=100}这里的perpage控制,也不受pagesize控制,不知道是个例还是都这样,我这里只能通过修改search.php中的
$ pagesize =(isset($pagesize)is_numeric($pagesize))?$pagesize:10;
这里的10来实现数量控制
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)