dedecms搜索頁面怎么單獨調用搜索結果條數

dedecms搜索頁面怎么單獨調用搜索結果條數

dedecms搜索頁面怎么單獨調用搜索結果條數?

DEDE的搜索結果數量都集成在了列表分頁標簽里,并沒有使用單獨的函數來提供這個結果數量,因此對有單獨調用搜索結果數量的用戶來說,就有使用問題,這里提供二次開發的方法。

推薦學習:織夢cms

非常簡單只要修改幾個地方就行了:

第一步,打開/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;?//當結果超過限制時,重設結果頁數 ????????if($this->TotalResult?>?$this->SearchMaxRc) ????????{ ????????????????$totalpage?=?ceil($this->SearchMaxRc/$this->PageSize); ????????} ????????$plist?.=?$this->TotalResult; ????????return?$plist; }

第三步,在搜索結果頁模板里要顯示結果條數的地方通過如下標簽調用:

{dede:itemcount?listsize='4'/}

這樣就可以實現搜索結果頁的搜索結果數量的單獨調用了。

以上就是

? 版權聲明
THE END
喜歡就支持一下吧
點贊8 分享