• 全国400电话网上服务平台
    强大号码库资源任选,方便,快捷,快速开通。
    咨询热线:400-1100-266  

    织梦栏目列表页实现第一页与其他页调用不同模板文件
    POST TIME:2021-05-23 01:44

    织梦栏目列表页实现第一页与其他页调用不同模板文件的修改方法如下:

    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

    最后更新系统缓存,静态的生成,动态的直接查看效果

    
    关于我们 | 付款方式 | 建站知识 | 增值服务 | 网站模板
    Copyright © 2003-2016
    时间:9:00-21:00 (节假日不休)
    版权所有:巨人网络(扬州)科技有限公司
    总部地址:江苏省信息产业基地11号楼四层
    《增值电信业务经营许可证》 苏B2-20120278
    X

    截屏,微信识别二维码

    微信号:veteran88

    (点击微信号复制,添加好友)

     打开微信

    微信号已复制,请打开微信添加咨询详情!