转载只是方便自己以后使用

1、官方菜单调用

                <nav id="nav-menu" class="clearfix" role="navigation">
                <a<?php if($this->is('index')): ?> class="current"<?php endif; ?> href="<?php $this->options->siteUrl(); ?>"><?php _e('首页'); ?></a>
                <?php $this->widget('Widget_Contents_Page_List')->to($pages); ?>
                <?php while($pages->next()): ?>
                <a<?php if($this->is('page', $pages->slug)): ?> class="current"<?php endif; ?> href="<?php $pages->permalink(); ?>" title="<?php $pages->title(); ?>"><?php $pages->title(); ?></a>
                <?php endwhile; ?>
            </nav>

这是官方默认主题调用方式,但是我们可以看到他只调用首页、页面,没有分类。

2、分类调用

              <nav id="nav-menu" class="clearfix" role="navigation">
                <a<?php if($this->is('index')): ?> class="current"<?php endif; ?> href="<?php $this->options->siteUrl(); ?>"><?php _e('首页'); ?></a>
                <?php $this->widget('Widget_Metas_Category_List')->to($category); ?>
           <?php while($category->next()): ?>
        <a<?php if($this->is('category', $category->slug)): ?> class="current"<?php endif; ?> href="<?php $category->permalink(); ?>" title="<?php $category->name(); ?>"><?php $category->name(); ?></a>
      <?php endwhile; ?>
            </nav>

这是只调用首页、分类的。然后我们可以根据官方的调用方式再衍生出来很多方式。对于CSS我们需要自定义设置,比如Current样式。

2、分类+页面方式

如果我们需要分类+页面的调用呢?

          <nav id="nav-menu" class="clearfix" role="navigation">
                <a<?php if($this->is('index')): ?> class="current"<?php endif; ?> href="<?php $this->options->siteUrl(); ?>"><?php _e('首页'); ?></a>
                <?php $this->widget('Widget_Contents_Page_List')->to($pages); ?>
       <?php while($pages->next()): ?>
       <a<?php if($this->is('page', $pages->slug)): ?> class="current"<?php endif; ?> href="<?php $pages->permalink(); ?>" title="<?php $pages->title(); ?>"><?php $pages->title(); ?></a>
      <?php endwhile; ?>
                <?php $this->widget('Widget_Metas_Category_List')->to($category); ?>
      <?php while($category->next()): ?>
      <a<?php if($this->is('category', $category->slug)): ?> class="current"<?php endif; ?> href="<?php $category->permalink(); ?>" title="<?php $category->name(); ?>"><?php $category->name(); ?></a>
      <?php endwhile; ?>
            </nav>


扫描二维码,在手机上阅读!