代理加盟

2023全新代理计划,一站式模板建站,铜牌代理低至699元送终身VIP,独立代理后台,自营贴牌。

您现在的位置: 麦站网 > 织梦大学 > 使用教程 >

DedeCMS列表第一页与其他分页不同模板

来源:本站原创 发布时间:2019-03-30 00:00:00热度:我要评论(0

麦站模板建站平台(10年经验),服务数万家企业,固定透明报价。域名注册、主机/服务器、网站源码一站式服务。实体公司,专业团队,值得选择!超过1000套模板已登记版权,合规合法建站,规避版权风险!【点击获取方案】

       DedeCMS列表分页首页和其他分页使用不同模板的方法有两种。前面写过利用{dede:pagelist}标签写PHP语句,DedeCMS列表分页标题第一页与首页内容重复,缺点是不能使用嵌套其他标签;下面是另一种实用方法,支持动态、静态模板。

DedeCMS页面分页首页不同模板

动态模板修改

       打开include/arc.listview.class.php,找到

$this->ParseTempletsFirst();

       上面添加

if($this->PageNo>1){
 $tmpdir = $GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir'];
 $tempfile = str_replace("{tid}",$this->TypeID,$this->Fields['templist']);
 $tempfile = str_replace("{cid}",$this->ChannelUnit->ChannelInfos['nid'],$tempfile);
 $tempfile = $tmpdir."/".$tempfile;
 $tmpfile2 = substr($tempfile,0,-4);
 $tempfile = $tmpfile2."2.htm"; 
 $this->dtp->LoadTemplate($tempfile);
}

静态模板修改

       继续在arc.listview.class.php找到

$this->ParseDMFields($this->PageNo,1);

        上面添加

if($this->PageNo>1){
 $tmpdir = $GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir'];
 $tempfile = str_replace("{tid}",$this->TypeID,$this->Fields['templist']);
 $tempfile = str_replace("{cid}",$this->ChannelUnit->ChannelInfos['nid'],$tempfile);
 $tempfile = $tmpdir."/".$tempfile;
 $tmpfile2 = substr($tempfile,0,-4);
 $tempfile = $tmpfile2."2.htm"; 
 $this->dtp->LoadTemplate($tempfile);
 $this->ParseTempletsFirst();
}

说明

       系统识别当前内容模型后面加2的模板作为其他分页模板,比如:list_article.htm为第一页模板,list_article2.htm为其他分页模板。

    转载请注明来源网址:https://www.xiuzhanwang.com/dedecms_jq/1375.html

    发表评论

    评论列表(条)

       
      QQ在线咨询
      VIP限时特惠