DedeCMS列表第一页与其他分页不同模板
原创DedeCMS列表分页首页和其他分页使用不同模板的方法有两种。前面写过利用{dede:pagelist}标签写PHP语句,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
版权声明:本文吖七(许祝岗)亲身经验原创,文中无商业推广,内容仅供参考,欢迎分享本文,转载请保留出处
- 上一篇:DedeCMS文章内容图片延迟加载
- 下一篇:DedeCMS彩色TAG标签云