php面包屑导航怎么做,超详细的ZBlog面包屑导航制作教程

应网友 @贺晋军博客 留言zblogphp面包屑导航怎么制作的?网上的文章是以前的,求指点,谢谢

关于什么是面包屑导航我想各位童鞋都应该非常的了解了吧,这里我就不再叙述了;先贴两段官方WIKI给的代码看下:

页面判断{if $type=='index'&&$page=='1'}  /*判断首页*/ {if $type=='category'}  /*判断分类页*/ {if $type=='article'}  /*判断日志页,不含独立页面,{if $article.Type==ZC_POST_TYPE_ARTICLE}(另一方案)*/ {if $type=='page'}  /*判断独立页面*/ {if $type=='author'}  /*判断用户页*/ {if $type=='date'}  /*判断日期页*/ {if $type=='tag'}  /*判断标签页*/

分类目录面包屑的代码编写{php} $html=''; function navcate($id){ global $html; $cate = new Category; $cate->LoadInfoByID($id); $html ='>>  Url.'" title="查看' .$cate->Name. '中的全部文章">' .$cate->Name. ' '.$html; if(($cate->ParentID)>0){navcate($cate->ParentID);} } navcate($article->Category->ID); global $html; echo $html; {/php}

上面这两段代码是官方wiki给出的,我们只要结合下以上的代码稍做修改就可以了,下面我们来看下烽烟博客模板使用的面包屑导航代码:{if $type == 'index'} 网站改版调试中! {elseif $type == 'category'}  首页 {php} $html=''; function navcate($id){ global $html; $cate = new Category; $cate->LoadInfoByID($id); $html ='»  Url.'" title="查看' .$cate->Name. '中的全部文章">' .$cate->Name. ' '.$html; if(($cate->ParentID)>0){navcate($cate->ParentID);} } navcate($category->ID); global $html; echo $html; {/php} {elseif $type =="article"}   首页  {php} $html=''; function navcate($id){ global $html; $cate = new Category; $cate->LoadInfoByID($id); $html ='»  Url.'" title="查看' .$cate->Name. '中的全部文章">' .$cate->Name. ' '.$html; if(($cate->ParentID)>0){navcate($cate->ParentID);} } navcate($article->Category->ID); global $html; echo $html;    {/php} » 正文 {elseif $type =="page"}   首页  » 正文  {elseif $type =="tag"}   首页  »  标签存档:{$tag.Name} {elseif $type =="author"}    首页   »  {$author.Name} 的文章 {/if}

将上面的代码添加到你想要显示的地方就行了,不过一般都在导航栏下方,效果可以参考烽烟博客。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值