How typecho implements the difference between the current catalog?

108 1

For more information on blog http://hellowiki. Com ( this typecho theme looks very comfortable ).
Search for a to find the effect of implementing the side bar effect. I didn't ask the designer fen. You see your help? I've trouble.

3 Answers

71 1

Here. $this->widget('Widget_Metas_Category_List') It's the key to determine the current catalog. <?php if($this->is('category', $categories->slug)):?> class="current"<?php endif;?> If this is the current category, the html in the category navigation is added to class="current", while the css style is customized by you.

The php code in the template is as follows:

<?php $this->widget('Widget_Metas_Category_List')->to($categories);?>
<?php while($categories->next()):?>
 <li<?php if($this->is('category', $categories->slug)):?> class="current"<?php endif;?>><a href="<?php $categories->permalink();?>"><?php $categories->name();?></a><i>&rArr; <?php $categories->count();?> posts</i></li>
<?php endwhile;?>
108 4
<?php $this->widget('Widget_Metas_Category_List')->to($category);?>

It's mainly to operate $category variables, and add a judgment statement

...