zblog首页和列表页分离 首页列表文章不显示置顶的方法
我们在做zblog主题的时候,需要在分类列表中显示置顶文章,而在首页不显示。
所以需要先把首页和列表页分离开来,index.php复制出三份,分别命名为index.php,default.php,list.php等等
index.php插入下面代码:
{if $type=='index'&&$page=='1'} /*判断首页*/ {template:default} {elseif $type=='category'} /*判断分类页*/ {template:list} {elseif $type=='article'} /*判断日志页,不含独立页面*/ {template:index_artile} {elseif $type=='page'} /*判断独立页面*/ {template:index_page} {elseif $type=='author'} /*判断用户页*/ {template:index_author} {elseif $type=='date'} /*判断日期页*/ {template:index_date} {elseif $type=='tag'} /*判断标签页*/ {template:index_tag} {/if}
具体文件名称自己定义就可以了。
我们在default.php文件中找到下面代码:
{foreach $articles as $article} {if $article.IsTop} {template:post-istop} {else} {template:post-multi} {/if} {/foreach}
替换为:
{foreach $articles as $article} {if $article.IsTop} {else} {template:post-multi} {/if} {/foreach}
这样置顶文章就不会显示在首页了,并不影响列表页置顶文章的显示。
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。
仍然有问题? 我们要如何帮助您?