当前位置 : 主页 > 网站建设 > 正文

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

原创

重庆seo2017-03-05 18:26:32阅读()dedecms页面分页A+ / A-

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

       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.vi586.com/web/394.html
    版权声明:原创文章,版权归重庆SEO吖七所有,欢迎分享本文,支持原创,转载请保留出处

    赞(2)