码迷,mamicode.com
首页 > 其他好文 > 详细

ZBLOG页面判断方法

时间:2019-10-12 13:04:31      阅读:116      评论:0      收藏:0      [点我收藏+]

标签:ati   comment   number   category   opera   改名   ble   判断   variable   

ZBLOG很多时候在不同的页面需要展示不同的内容,判断页面类型的代码如下:

PHP
{if $type==‘index‘&&$page==‘1‘}  /*判断首页*/
{if $type==‘category‘}  /*判断分类页*/
{if $type==‘article‘}  /*判断日志页,不含独立页面,{if $article.Type==ZC_POST_TYPE_ARTICLE}(另一方案)*/
{if $type==‘page‘}  /*判断独立页面*/
{if $type==‘author‘}  /*判断用户页*/
{if $type==‘date‘}  /*判断日期页*/
{if $type==‘tag‘}  /*判断标签页*/

示例:首页和分类列表页分离

在index.php文件里作判断,分离模板。比如:

PHP
{if $type==‘index‘&&$page==‘1‘} 
{template:c_index}
{else}
{template:c_list}
{/if}

然后新建两个相应的模板文件:c_index.php(原index.php改名即可)和c_list.php(原index.php复制并改名即可)

其中c_index.php为首页,c_list.php为除了首页之外的其他列表页。

ZBLOG页面判断方法

标签:ati   comment   number   category   opera   改名   ble   判断   variable   

原文地址:https://www.cnblogs.com/chao567/p/11660616.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!