zblog模板制作中常用到if语句,特别是页面的判断,比如某些模块只需要在首页显示,抑或者只在文章页面显示,那么用if判断是最快最省力的一种方式了。
可能刚接触zblog模板的用户还不太清楚在网站模板制作需要用到哪些if,下面详细说明下:
{if $type=='index'&&$page=='1'} /*判断首页*/
{template:index_default}
{elseif $type=='category'} /*判断分类页*/
{$category.Name}
{elseif $type=='article'} /*判断日志页,不含独立{$article.Title}
{template:index_artile}
{elseif $type=='page'} /*判断独立页面*/
{template:index_page}
{elseif $type=='author'} /*判断用户页*/
{$author.Name}/{$author.StaticName}
{elseif $type=='date'} /*判断日期页*/
date- {$title}
{elseif $type=='tag'} /*判断标签页*/
{$tag.Name}
{else}
{$title}
{/if}以上if,属于基本的判断,在制作带有公共侧栏模板的时候特别需要这种判断;
所以需要做zblog模板的要死记硬背,至少收藏吧。
本文由主题码原创或收集发布;
阅读:231369时间:2021-04-12
阅读:230300时间:2021-05-26
阅读:228005时间:2021-04-12
阅读:224196时间:2021-04-12
阅读:174163时间:2021-04-12