织梦DedeCMS搜索页面搜索结果总数调用方法

  由于dedecms原生不支持搜索页面结果总数的调用,所以得自己修改文件来支持了。搜索页面调用的代码全在/include/arc.searchview.class.php里,我们先打开/include/arc.searchview.class.php文件,然后按下面步骤修改文件:
  第一步:在

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));
}

  第二步:在

/**
 *  获得当前的页面文件的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'/} 即可 。

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值