织梦栏目列表页实现第一页与其他页调用不同模板文件的修改方法如下:
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',$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}",$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网站安全设置防挂马教程
下一篇:织梦系统如何增加字体
总结以上是内存溢出为你收集整理的织梦栏目列表页实现第一页与其他页调用不同模板文件全部内容,希望文章能够帮你解决织梦栏目列表页实现第一页与其他页调用不同模板文件所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)