首页、分类页、用户页、日期页和标签页都是用的index.php模板页面,如想个性化设置每个页面的模板,可以这样判断
{if $type=='index'&&$page=='1'} <!--/*判断首页*/--> {template:c_list_index} {elseif $type=='category'} <!--/*判断分类页*/--> {template:c_list_cate} {elseif $type=='author'} <!--/*判断用户页*/--> {template:c_list_author} {elseif $type=='date'} <!--/*判断日期页*/ --> {template:c_list_date} {elseif $type=='tag'} <!--/*判断标签页*/--> {template:c_list_tag} {else} <!--/*其他自定义列表页面*/--> {template:c_list} {/if}
判断内容页或者单页
{if $article.Type==0} <!--/*判断文章内页*/--> {template:post-single} {else} <!--/*判断单页*/--> {template:post-page} {/if}
判断当前页面类型
{if $type=='article'} {elseif $type=='page'} {elseif $type=='category'} {elseif $type=='index'} {/if}
判断管理员登录展示内容,否则跳转到登录页面
{if $user.Level==1} {else} {Redirect('/zb_system/login.php')} {/if}
不同分类,展示不同内容
{if $article.Category.ID=='1'} {elseif $article.Category.ID=='2'} {elseif $article.Category.ID=='3'} {/if}
PC端,移动端加载不同模板
{if !zbp_is_mobile()} {template:pc-index} {else} {template:m-index} {/if}
评论数判断
{if $article.CommNums==0} 暂无留言 {elseif $article.CommNums==1} 仅有1条留言 {else} 已有{$article.CommNums}条留言 {/if}