Typecho文档站点下is语法

typecho可以使用is语法判断内容是比较多
具体如下:

$this->is('index');
$this->is('archive');
$this->is('single');
$this->is('page');
$this->is('post');
$this->is('category');
$this->is('tag');

常用的判断有
上述判断是基于模板文件结构来的,具体可以参考《typecho文档下的系统使用要求及文件结构说明
甚至是可以带有相对应的参数

$this->is('category', 'default');
$this->is('page', 'start');
$this->is('post', 1);

需要注意的是,后面的参数是分类、页面的缩略名 写法

<?php if ($this->is('post')) : ?>
    这里就是内容了
<?php endif; ?>

猜你喜欢

转载自blog.csdn.net/virone/article/details/130884203
今日推荐