织梦栏目列表页实现第一页与其他页调用不同模板文件
织梦栏目列表页实现第一页与其他页调用不同模板文件的修改方法如下:
1、打开 /include/arc.listview.class.php 找到,大概在第330行
$this->ParseDMFields($this->PageNo,1); |
在它的上面加入
$tempfile = $GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir']."/".$this->TypeLink->TypeInfos['templist']; $tempfile = str_replace("{tid}", $this->TypeID, $tempfile); $tempfile = str_replace("{cid}", $this->ChannelUnit->ChannelInfos['nid'], $tempfile); if ( defined('DEDEMOB') ) { $tempfile =str_replace('.htm','_m.htm',$tempfile); } if(!file_exists($tempfile)) { $tempfile = $GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir']."/".$GLOBALS['cfg_df_style']."/list_default.htm"; if ( defined('DEDEMOB') ) { $tempfile =str_replace('.htm','_m.htm',$tempfile); } } if(!file_exists($tempfile)||!is_file($tempfile)) { echo $this->Fields['typename']." [ID:{$this->TypeID}] ".$GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir']."/".$this->TypeLink->TypeInfos['templist']."模板文件不存在,无法解析文档!"; exit(); } if( $this->PageNo===1 ) { $tempfile2 =str_replace('.htm','_1.htm',$tempfile); if(file_exists($tempfile2) && is_file($tempfile2)) { $this->dtp->LoadTemplate($tempfile2); $this->ParseTempletsFirst(); } } else { $this->dtp->LoadTemplate($tempfile); } |
2、继续找到,大概在第450行的
$this->ParseTempletsFirst(); |
注意是在第450行左右的这个代码,因为这个代码有3处,请认准是在大概第450行上这个
找到后在它的上面加入
$tempfile = $GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir']."/".$this->TypeLink->TypeInfos['templist']; $tempfile = str_replace("{tid}", $this->TypeID, $tempfile); $tempfile = str_replace("{cid}", $this->ChannelUnit->ChannelInfos['nid'], $tempfile); if ( defined('DEDEMOB') ) { $tempfile =str_replace('.htm','_m.htm',$tempfile); } if(!file_exists($tempfile)) { $tempfile = $GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir']."/".$GLOBALS['cfg_df_style']."/list_default.htm"; if ( defined('DEDEMOB') ) { $tempfile =str_replace('.htm','_m.htm',$tempfile); } } if(!file_exists($tempfile)||!is_file($tempfile)) { echo $this->Fields['typename']." [ID:{$this->TypeID}] ".$GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir']."/".$this->TypeLink->TypeInfos['templist']."模板文件不存在,无法解析文档!"; exit(); } if( $this->PageNo===1 ) { $tempfile2 =str_replace('.htm','_1.htm',$tempfile); if(file_exists($tempfile2) && is_file($tempfile2)) { $this->dtp->LoadTemplate($tempfile2); } } else { $this->dtp->LoadTemplate($tempfile); } |
3、第一页模板,在原栏目列表模板后面加_1
例如,原列表模板是 list_article.htm
如果你想让第一页跟list_article.htm不一样的话,你可以建立一个
list_article_1.htm
系统在动态或者生成静态时,栏目列表第一页优先去找这个 _1 的第一页模板文件,存在就输出,不存在就使用默认的原列表模板 list_article.htm
最后更新系统缓存,静态的生成,动态的直接查看效果
上一篇:DEDE网站安全设置防挂马教程
下一篇:织梦系统如何增加字体
免责声明:本站所有文章和图片均来自用户分享和网络收集,文章和图片版权归原作者及原出处所有,仅供学习与参考,请勿用于商业用途,如果损害了您的权利,请联系网站客服处理。
来源:网友投稿 关注:
时间:2019-11-13 10:24
☉首先声明,只要是我们的vip会员所有源码均可以免费下载,不做任何限制(了解更多)
☉本站的源码不会像其它下载站一样植入大量的广告。为了更好的用户体验以后坚持不打水印
☉本站只提供精品织梦源码,源码在于可用,不在多!!希望在这里找到你合适的。
☉本站提供的整站织梦程序,均带数据及演示地址。可以在任一源码详情页查看演示地址
☉本站所有资源(包括源码、模板、素材、特效等)仅供学习与参考,请勿用于商业用途。
☉如有其他问题,请加网站客服QQ进行交流。
☉本站的源码不会像其它下载站一样植入大量的广告。为了更好的用户体验以后坚持不打水印
☉本站只提供精品织梦源码,源码在于可用,不在多!!希望在这里找到你合适的。
☉本站提供的整站织梦程序,均带数据及演示地址。可以在任一源码详情页查看演示地址
☉本站所有资源(包括源码、模板、素材、特效等)仅供学习与参考,请勿用于商业用途。
☉如有其他问题,请加网站客服QQ进行交流。
相关织梦教程:
- dedecms SQL注入漏洞 member/album_add.php 修复
- dedecms cookies泄漏导致SQL漏洞 /member/article_add
- Windows虚拟主机指定目录禁用脚本执行权限方法
- 西部数码虚拟主机设置禁止脚本执行权限
- 阿里云主机设置织梦程序禁止脚本执行权限及禁止写入
- dedecms织梦导致CPU峰值现象的解决办法
- 织梦程序网站被挂马或快照劫持终极解决办法
- 阿里云提醒/member/reg_new.php注入漏洞解决办法
- 织梦安全:更改plus名称
- 织梦栏目属性增加链接rel、nofollow和新窗口target
- 织梦问答模块PHP7报错解决方法
- dedecms解决移动端首页不自动更新问题