typecho教程:输出全部分类 – 当前分类current
输出全部分类 – 当前分类current
2013-03-26
输出全部分类,并对当前分类current标记:
<ul id="nav_menu"> <?php $this->widget('Widget_Metas_Category_List')->to($category); ?> <?php while ($category->next()): ?> <li<?php if ($this->is('post')): ?><?php if ($this->category == $category->slug): ?> class="current"<?php endif; ?><?php else: ?><?php if ($this->is('category', $category->slug)): ?> class="current"<?php endif; ?><?php endif; ?>><a href="<?php%20$category->permalink();%20?>" title="<?php $category->name(); ?>"><?php $category->name(); ?></a></li> <?php endwhile; ?> </ul>
单独输出所有分类:
<?php $this->widget('Widget_Metas_Category_List') ->parse('<li class="cat-item"><a href="{permalink}">{name}</a> ({count})</li>'); ?>