織夢在搜索結(jié)果頁面并沒有構(gòu)造單獨的函數(shù)來實現(xiàn)調(diào)用結(jié)果數(shù)量,結(jié)果數(shù)都集成在列表分頁標簽里了,如果我們需要這個數(shù)量的單獨調(diào)用,就要進行二次開發(fā)了。
其實很簡單,教大家如何實現(xiàn):
第一步,打開/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; //當結(jié)果超過限制時,重設結(jié)果頁數(shù) if($this->TotalResult > $this->SearchMaxRc) { $totalpage = ceil($this->SearchMaxRc/$this->PageSize); } $plist .= $this->TotalResult; return $plist;}第三步,在搜索結(jié)果頁模板里要顯示結(jié)果條數(shù)的地方通過如下標簽調(diào)用:
{dede:itemcount listsize='4'/}這樣就可以實現(xiàn)搜索結(jié)果頁的搜索結(jié)果數(shù)量的單獨調(diào)用了。
以上就是織夢dedecms搜索頁面單獨調(diào)用搜索結(jié)果條數(shù)的實現(xiàn)方法的全部內(nèi)容,希望對大家的學習和解決疑問有所幫助,也希望大家多多支持武林網(wǎng)。新聞熱點
疑難解答
圖片精選