添加函数
/*面包屑导航*/
function get_bread_nav($module,$trem_id){
$arr['href']['action']=$module;
$arr['href']['param']['id']=$trem_id;
$nav=M('nav');
$rs=$nav->select();
foreach($rs as $k=>$v){
$rs[$k]['href']=unserialize(stripslashes($v['href']));
}
if($module!='home'){
foreach($rs as $k=>$v){
if($v['href']==$arr['href']){
$a=$v;
}
}
$bread_path=$a['path'];
$arr_path=explode("-",$bread_path);
$str_path="
首页";for($i=1;$i
$breadtitle=$nav->where("id=$arr_path[$i] and status=1 ")->find();
$breadtitle['href']=unserialize($breadtitle['href']);
$href=leuu($breadtitle['href']['action'],array('id'=>$breadtitle['href']['param']['id']));
$str_path.="
".$breadtitle['label']."";}
}else{
$str_path="
首页";}
return $str_path;
}
模版中调用
list 页面调用
{:get_bread_nav('Portal/List/index',$cat_id)}
page 页面调用
{:get_bread_nav('Portal/Page/index',$id)}
article 页面调用(后面自行添加文章标题)
{:get_bread_nav('Portal/List/index',$term_id)}