差别
这里会显示出您选择的修订版和当前版本之间的差别。
— |
themes:is-syntax [2013/10/21 06:55] (当前版本) |
||
---|---|---|---|
行 1: | 行 1: | ||
+ | typecho可以使用is语法判断很多东西,比如 | ||
+ | <code php> | ||
+ | $this->is('index'); | ||
+ | $this->is('archive'); | ||
+ | $this->is('single'); | ||
+ | $this->is('page'); | ||
+ | $this->is('post'); | ||
+ | $this->is('category'); | ||
+ | $this->is('tag'); | ||
+ | </code> | ||
+ | 甚至是 | ||
+ | <code php> | ||
+ | $this->is('category', 'default'); | ||
+ | $this->is('page', 'start'); | ||
+ | $this->is('post', 1); | ||
+ | </code> | ||
+ | 需要注意的是,后面的参数是分类、页面的缩略名 | ||
+ | 写法 | ||
+ | <code php> | ||
+ | <?php if ($this->is('post')) : ?> | ||
+ | 这里就是内容了 | ||
+ | <?php endif; ?> | ||
+ | </code> |