帝国cms导航栏目利用灵动标签实现当前栏目高亮效果
2017-12-07 站长 站长日志
帝国cms导航栏目利用灵动标签实现当前栏目高亮效果
具有子栏目的导航效果:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
<ul>
<li class = "menu-item menu-item-type-custom <?php if($GLOBALS[navclassid]==" "){ echo 'current-menu-item' ;
} ?> menu-item-object-custom menu-item-home "><a href=" [!--news.url--]">首页</a></li>
[e:loop={ "select classid,classname,sonclass from {$dbtbpre}enewsclass where bclassid=0 order by myorder,classid asc" ,0,24,0}]
<li class ="menu-item menu-item-type-custom menu-item-object-custom
<?php
if ( $bqr [classid]==1){
$classurl = '#' ;
} else {
$classurl =sys_ReturnBqClassname( $bqr ,9); //取得栏目地址
}
$GLOBALS [navclassid]= $GLOBALS [navclassid]? $GLOBALS [navclassid]:0;
if ( $GLOBALS [navclassid])
{
$fcr = explode ( '|' , $class_r [ $GLOBALS [navclassid]][featherclass]);
$topbclassid = $fcr [1]? $fcr [1]: $GLOBALS [navclassid]; //取得当前栏目的一级栏目ID
}
if ( $bqr [classid]== $topbclassid || $bqr [classid]== $GLOBALS [navclassid])
{
echo 'current-menu-item' ;
}
if (! empty ( $bqr [sonclass])){
echo 'menu-item-has-children' ;
}
?> "><a href=" <?= $classurl ?>"><?= $bqr [classname]?></a>
<?php if (! empty ( $bqr [sonclass])){ ?>
<ul class = "sub-menu" >
[showclasstemp] $bqr [classid],1,0,0[/showclasstemp]
</ul>
<?php } ?>
</li>
[/e:loop]
</ul>
|
实现一级栏目的导航效果:
1 2 3 4 5 6 7 8 |
< ul >
< li >< a href = "[!--news.url--]" <?php if($GLOBALS[navclassid]==""){echo ' id = "nav_default" ';
} ?>>首页</ a ></ li >
[e:loop={"select classid,classname from {$dbtbpre}enewsclass where bclassid=0 order by myorder,classid asc",0,24,0}]
<? php $ classurl = sys_ReturnBqClassname ($bqr,9);//取得栏目地址 ?>
< li >< a href="<?=$classurl?>" <? php if($bqr[classid]==$GLOBALS[navclassid]){echo ' id = "nav_default" ';} ?>><?=$bqr[classname]?></ a ></ li >
[/e:loop]
</ ul >
|