网上找到的是这个
<?php $this->widget('Widget_Metas_Category_List')->listCategories('wrapClass=widget-list'); ?>
这个代码是一级分类和子栏目都输出的,但我只想单独输出当前分类下的子栏目。
如:
导航分类样式 首页 新闻 图片 专题
子栏目样式(默认首页不显示的) 当页面在新闻分类下显示新闻的子菜单,当页面在图片分类下显示图片的子菜单
怎样单独输出二级菜单导航?
Re: 怎样单独输出二级菜单导航?
这个我要帮你顶下,因为好多人,都需要解决这个问题。你的描述让人糊涂,我替你: 首页显示所有父类,其中一个父母假设叫水果, 点击这个水果,进入水果父类下的所有文章列表页,然后在这个列表页上方,显示子类,如香蕉,樱桃………
是这个意思吧。 我也是同求。 唉。 喜欢简洁的te,可是简洁也是有代价的,硬币的两面呀……
是这个意思吧。 我也是同求。 唉。 喜欢简洁的te,可是简洁也是有代价的,硬币的两面呀……
Re: 怎样单独输出二级菜单导航?
我也遇到了这个问题,在网上没查到解决方案,https://segmentfault.com/q/1010000005983090 这个是我贴出来的详细需求
Re: 怎样单独输出二级菜单导航?
编辑主题模板可实现,实例 ideager.com 中的作品浮动层就是二级菜单!
以下是源代码,把二级菜单绑定在slug为handmade页面导航菜单上
以下是源代码,把二级菜单绑定在slug为handmade页面导航菜单上
代码: 全选
<ul class="header-nav">
<?php $this->widget('Widget_Contents_Page_List')->to($pages); ?>
<?php while($pages->next()): ?>
<li>
<a href="<?php $pages->permalink(); ?>" class="ajax-link<?php if($this->is('page', $pages->slug)): ?> current<?php endif; ?>"><?php $pages->title(); ?></a>
<?php if($this->is($pages->slug == 'handmade')): ?>
<?php $this->widget('Widget_Metas_Category_List')->to($categorys); ?>
<?php while($categorys->next()): ?>
<?php if ($categorys->levels === 0): ?>
<?php $children = $categorys->getAllChildren($categorys->mid); ?>
<ul>
<?php foreach ($children as $mid) { ?>
<?php $child = $categorys->getCategory($mid); ?>
<li><a href="<?php echo $child['permalink'] ?>" class="ajax-link<?php if($this->is('category', $mid)): ?> active<?php endif; ?>"><?php echo $child['name']; ?></a><span class="badge"><?php echo $child['count']; ?></span></li>
<?php } ?>
</ul>
<?php endif; ?>
<?php endwhile; ?>
<?php endif; ?>
</li>
<?php endwhile; ?>
</ul>
Re: 怎样单独输出二级菜单导航?
Eager 写了:编辑主题模板可实现,实例 ideager.com 中的作品浮动层就是二级菜单!
以下是源代码,把二级菜单绑定在slug为handmade页面导航菜单上代码: 全选
<ul class="header-nav">
<?php $this->widget('Widget_Contents_Page_List')->to($pages); ?>
<?php while($pages->next()): ?>
<li>
<a href="<?php $pages->permalink(); ?>" class="ajax-link<?php if($this->is('page', $pages->slug)): ?> current<?php endif; ?>"><?php $pages->title(); ?></a>
<?php if($this->is($pages->slug == 'handmade')): ?>
<?php $this->widget('Widget_Metas_Category_List')->to($categorys); ?>
<?php while($categorys->next()): ?>
<?php if ($categorys->levels === 0): ?>
<?php $children = $categorys->getAllChildren($categorys->mid); ?>
<ul>
<?php foreach ($children as $mid) { ?>
<?php $child = $categorys->getCategory($mid); ?>
<li><a href="<?php echo $child['permalink'] ?>" class="ajax-link<?php if($this->is('category', $mid)): ?> active<?php endif; ?>"><?php echo $child['name']; ?></a><span class="badge"><?php echo $child['count']; ?></span></li>
<?php } ?>
</ul>
<?php endif; ?>
<?php endwhile; ?>
<?php endif; ?>
</li>
<?php endwhile; ?>
</ul>
谢谢,因为有人回帖了系统也没有提示,所以我好久都没打开这个贴了,非常感谢你的回复