织梦仿站首页列表页文章带图标(织梦栏目列表页第一个文档与其他文档不同教程 )

优采云 发布时间: 2021-09-11 20:02

  织梦仿站首页列表页文章带图标(织梦栏目列表页第一个文档与其他文档不同教程

)

  栏目列表页第一页+分页栏效果

  

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

  

  在之前的教程中,列列表页面的第一个文档与其他文档不同。教程《织梦列列表页首文章与其他文章不同的样式》

  本教程实现了将第一页的模板和第二页、第三页、后续页的其他页调用的不同模板分成两个列列表模板。本教程支持动态和静态栏目页面,以伪静态模式使用。

  第一步是修改核心文件

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

}

}

else

{

$this->dtp->LoadTemplate($tempfile);

}

$this->ParseTempletsFirst();

  如图所示

  

  继续找,大概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

  

  第三步更新生成

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

  

0 个评论

要回复文章请先登录注册


官方客服QQ群

微信人工客服

QQ人工客服


线