织梦栏目列表页实现领先页与其他页调用不同模板文件

资源来源网络,如需授权,请更换源码,模块仅供学习,如需商用请购买正版授权,本栏目不提供技术服务,积分不够请签到!如何签到?系统升级暂停签到,恢复关注公告!
如遇下载链接蓝奏网盘打不开lanzous替换成lanzoux尝试! 广告

栏目列表页领先页+分页条效果

栏目列表页第二页和其他页

前面有教程讲到栏目列表页领先个文档与其他文档不同教程《织梦栏目列表页领先个文章与其他文章不同样式》

这次教程实现的是领先页的模板与其他第二页、第三页、、、后面的页调用的不同模板,分开为2个栏目列表模板,此教程支持栏目页动态、静态、伪静态下使用。
领先步 修改核心文件

打开 /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);
}

如图

%title插图%num

继续找到,大概在第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);
}

如图

第二步 添加领先页模板文件及命名

领先页模板,在原栏目列表模板后面加_1

例如,原列表模板是 list_dongwu.htm

如果你想让领先页跟list_dongwu.htm不一样的话,你可以建立一个

list_dongwu_1.htm

系统在动态或者生成静态时,栏目列表领先页优先去找这个 _1 的领先页模板文件,存在就输出,不存在就使用默认的原列表模板 list_dongwu.htm

第三步 更新生成

©下载资源版权归作者所有;本站所有资源均来源于网络,仅供学习使用,请支持正版!
风格酷模板网 » 织梦栏目列表页实现领先页与其他页调用不同模板文件
NOTICE:【咨询风格酷】客服QQ:1131734965
NOTICE:【咨询风格酷】客服微信:wwwxmamnet
NOTICE:【风格酷模板网②群】QQ群:288678775
☉免责声明:本站所有模板均来自用户分享和网络收集,仅供学习与参考,请勿用于商业用途,如果损害了您的权利,请联系网站客服,我们核实后会立即删除。
☉如果源码网盘地址失效!或有其他问题,请点我报错,谢谢合作!
☉人民币与积分汇率为1比10,即1元=10积分.有任何疑问请联系客服
☉如有其他问题,请加网站客服QQ(1131734965)进行交流。
☉本站提供的源码、模板、软件工具等其他资源,都不包含技术服务,请大家谅解!
☉源码、模板等资源会随着技术、环境的升级而存在部分问题,还请慎重选择。

发表评论

风格酷模板网www.xmam.net分享优质网站模板

立即查看 了解详情