前一篇文章写了关于本站zblog for php面包屑导航实现一级两级智能显示的文章(点击直达),不能再分类列表中实现,当时我就知道了,早已经实现了,自己写的,呵呵,但是没时间发,呵呵,看博客的时候有网友问了下问题,所以顺便发下,算是对那篇文章的补充吧,呵呵。不发牢骚了,直接来步骤:
(1)在列表页模板(我的主页和列表页模板没有分离)index.php添加如下代码:
<div class="display archive-header"> <header> <div class="right"> <div id="breadcrumb" class="bc94"> 当前位置: <a href="{$host}"><i class="fa fa-home"></i>首页</a> {if $category.ParentID > 0} {template:post-nav2} {else} <i class="fa fa-angle-right"> </i> {$category.Name} {/if} </div> </div> <h2 class="title"> <i class="fa fa-folder-open-o"></i>{$category.Name} <a class="rss" title="RSS 订阅本站" href="{$host}/sitemap.xml"noajax="true"> <i class="fa fa-rss"></i> </a> </h2> </header> <div class="main"> <p>{$category.Intro}</p> </div> </div>
ps:当然这段代码外部需要添加如下判断语句了。
{if $type=='category'} {/if}
(2)添加导航文件post-nav2.php模板。模板内容如下:
{php} $newcategory=$zbp->GetCategoryByID($category->ParentID); {/php} <i class="fa fa-angle-right"></i> <a href="{$newcategory.Url}" title="查看{$newcategory.Name}中的全部文章">{$newcategory.Name}</a> <i class="fa fa-angle-right"></i> {$category.Name}
(3)效果如本站分类效果。
PS:希望对你有所帮助,谢谢大家对涂涂研版的支持。
本篇文章在zblog的论坛上发布后,收到了博友
的提醒,可以有更简便的方法,而不必要新建函数来实现:以下为代码:{if $type=='category'} 当前位置:{$name}{if $category.Parent.Parent.Name} > {$category.Parent.Parent.Name} {/if}{if $category.Parent.Name} > {$category.Parent.Name} {/if} > {$title} {/if}
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请通知我们,一经查实,本站将立刻删除。