Typecho 热点标签挪用及标签云挪用
1、有些模板侧边栏会条用到标签,有些会挪用热点标签,这就要用到以下代码了,实际上就是挪用标签加上排序
代码以下:
<div class="widget"><h3><?php _e('热点标签'); ?></h3> <ul class="cate"> <?php $this->widget('Widget_Metas_Tag_Cloud', array('sort' => 'count', 'ignoreZeroCount' => true, 'desc' => true, 'limit' => 20))->to($tags); ?> <?php while($tags->next()): ?> <li><a rel="tag" href="<?php $tags->permalink(); ?>"><?php $tags->name(); ?></a></li> <?php endwhile; ?><div class="clear"></div> </ul></div>剖析一下大抵意义以下:
'sort' => 'count' 应该是示意按标签数目排序;'ignoreZeroCount' => true 应该是示意过滤掉数目为0的空标签;'limit' => 20 应该是示意挪用标签数目为20个;至于标签的款式,由CSS掌握,自行修正。
至于标签云挪用请看以下代码:
<div class="widget"><h3><?php _e('一切标签'); ?></h3> <ul class="cate"> <?php $this->widget('Widget_Metas_Tag_Cloud')->to($tags); ?> <?php while($tags->next()): ?> <li><a rel="tag" href="<?php $tags->permalink(); ?>"><?php $tags->name(); ?></a></li> <?php endwhile; ?><div class="clear"></div> </ul></div>就这么简朴,就能够了

评论列表