循环页面、分类、标签

2020-03-18
    <!--循环显示页面-->
    <?php $this->widget('Widget_Contents_Page_List')->to($pages); ?>
    <?php while($pages->next()): ?>

    <span class="nav-item<?php if($this->is('page', $pages->slug)): ?> nav-item-current<?php endif; ?>">
    <a href="<?php $pages->permalink(); ?>" title="<?php $pages->title(); ?>">
    <span><?php $pages->title(); ?></span>
    </a>
    </span>
    <?php endwhile; ?>
    <!--结束显示页面-->

    <!--循环所有分类-->
    <?php $this->widget('Widget_Metas_Category_List')->to($category); ?>
    <?php while ($category->next()): ?>

    <span class="nav-item<?php if($this->is('category', $category->slug)): ?> nav-item-current<?php endif; ?>">
    <a href="<?php $category->permalink(); ?>" title="<?php $category->name(); ?>">
    <span><?php $category->name(); ?></span>
    </a>
    </span>
    <?php endwhile; ?>
    <!--结束显示分类-->

    <!--循环显示标签 其中limit的5为显示数量-->
	<?php $this->widget('Widget_Metas_Tag_Cloud', array('sort' => 'count', 'ignoreZeroCount' => true, 'desc' => true, 'limit' => 5))->to($tags); ?>   
	<?php while($tags->next()): ?> 

	<span class="nav-item<?php if($this->is('tag', $tags->slug)): ?> nav-item-current<?php endif; ?>">
    <a href="<?php $tags->permalink(); ?>" title="<?php $tags->name(); ?>">
    <span><?php $tags->name(); ?></span>
    </a>
    </span>
	<?php endwhile; ?>
    <!--结束显示标签-->