• 全国400电话网上服务平台
    强大号码库资源任选,方便,快捷,快速开通。
    咨询热线:400-1100-266  

    织梦dedecms搜索结果页调用总搜索条数的教程
    POST TIME:2021-05-23 02:53

    要实现织梦dedecms搜索结果页调用总搜索条数,需修改代码,打开根目录下/include/arc.searchview.class.php

    效果演示

    第一步、找到大概第533行,找到
    1
    2
    3
    4
    5
    6
    7
    8
    9
    else if($tagname=="pagelist")
    {
      $list_len = trim($ctag->GetAtt("listsize"));
     if($list_len=="")
     {
      $list_len = 3;
     }
      $this->dtp->Assign($tagid,$this->GetPageListDM($list_len));
    }

    在这句代码的下面加入:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    else if($tagname=="itemcount")
    {   
        $list_len = trim($ctag->GetAtt("listsize"));   
        if($list_len=="")   
        {
            $list_len = 3;   
        }   
        $this->dtp->Assign($tagid,$this->GetItemsCountDM($list_len));
    }
    第二步、继续找到大概935行:
    1
    2
    3
    4
    5
    6
    /**
     *  获得当前的页面文件的url
     *
     * @access    public
     * @return    string
     */

    在这句代码的上面添加以下代码:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    //————  
    //搜索输出总量www.dede58.com织梦模板下载  
    //————  
    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'/} 即可调用


    
    关于我们 | 付款方式 | 建站知识 | 增值服务 | 网站模板
    Copyright © 2003-2016
    时间:9:00-21:00 (节假日不休)
    版权所有:巨人网络(扬州)科技有限公司
    总部地址:江苏省信息产业基地11号楼四层
    《增值电信业务经营许可证》 苏B2-20120278
    X

    截屏,微信识别二维码

    微信号:veteran88

    (点击微信号复制,添加好友)

     打开微信

    微信号已复制,请打开微信添加咨询详情!