DEDE的搜索結果數(shù)量都集成在了列表分頁標簽里,并沒有使用單獨的函數(shù)來提供這個結果數(shù)量,因此對有單獨調(diào)用搜索結果數(shù)量的用戶來說,就有使用問題,這里提供二次開發(fā)的方法。
非常簡單只要修改幾個地方就行了:
第一步,打開/include/arc.searchview.class.php文件,查找代碼(大概在第525行):
else if($tagname=="pagelist"){ $list_len = trim($ctag->GetAtt("listsize")); if($list_len=="") { $list_len = 3; } $this->dtp->Assign($tagid,$this->GetPageListDM($list_len));} |
在下面添加代碼:
else if($tagname=="itemcount"){ $list_len = trim($ctag->GetAtt("listsize")); if($list_len=="") { $list_len = 3; } $this->dtp->Assign($tagid,$this->GetItemsCountDM($list_len));} |
第二步,查找代碼(大概在第925行):
/** * 獲得當前的頁面文件的url * * @access public * @return string */
在其上面添加下面的這段代碼:
function GetItemsCountDM($list_len){ global $oldkeyword; $pagenow = ($this->PageNo-1) * 10 + 1; $pagenows = $this->PageNo*10; //當結果超過限制時,重設結果頁數(shù) if($this->TotalResult > $this->SearchMaxRc) { $totalpage = ceil($this->SearchMaxRc/$this->PageSize); } $plist .= $this->TotalResult; return $plist;} |
第三步,在搜索結果頁模板里要顯示結果條數(shù)的地方通過如下標簽調(diào)用:
{dede:itemcount listsize='4'/}
這樣就可以實現(xiàn)搜索結果頁的搜索結果數(shù)量的單獨調(diào)用了。
新聞熱點
疑難解答
圖片精選