DedeCMS搜索页面调用搜索结果条数
以下代码由PHP站长网 52php.cn收集自互联网现在PHP站长网小编把它分享给大家,仅供参考 织梦在搜索结果页面并没有构造单独的函数来实现调用结果数量,结果数都集成在列表分页标签里了,如果我们需要这个数量的单独调用,就要进行二次开发了。其实很简单,织梦学习网来教大家如何实现:第一步,打开/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'/} 这样就可以实现搜索结果页的搜索结果数量的单独调用了。 以上内容由PHP站长网【52php.cn】收集整理供大家参考研究如果以上内容对您有帮助,欢迎收藏、点赞、推荐、分享。 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |