帝国cms栏目页导航调用并高亮变色
帝国cms栏目页导航调用并高亮变色+当栏目ID=1时和别的变色不一样的写法
1、直接调用子栏目并高亮变色
<? php $islast=$class_r[$GLOBALS[navclassid]][islast];//当前栏目判断是否为终级栏目 $bclassid=$class_r[$GLOBALS[navclassid]][bclassid];//获取当前父栏目ID ?> [e:loop={"select * from phome_enewsclass where bclassid='".$bclassid."'",24,24,1}] <? php $ classurl = sys_ReturnBqClassname ($bqr,9);//取得栏目地址 $ class = "" ; if($GLOBALS[navclassid]){ if($bqr[classid]==$GLOBALS[navclassid]) { $ class = "on" ; }} ?> |
2、判断:
".$bclassid."会调用所有的一级父栏目,.$GLOBALS[navclassid].调用当前栏目
<div class = "comt" > <ul> <?php $islast = $class_r [ $GLOBALS [navclassid]][islast]; //当前栏目判断是否为终级栏目 $bclassid = $class_r [ $GLOBALS [navclassid]][bclassid]; //获取当前父栏目ID ?> <?php if ( $islast ==1 and $bclassid ==0) { ?> [e:loop={ "select * from phome_ecms_news where classid='" . $GLOBALS [navclassid]. "'" ,20,24,1}] <?php $classurl =sys_ReturnBqClassname( $bqr ,9); //取得栏目地址 $class = "" ; if ( $GLOBALS [navclassid]){ if ( $bqr [classid]== $GLOBALS [navclassid]) { $class = "on" ; }} ?> <li><a href= "<?=$bqsr[titleurl]?>" class = "<?=$class?>" ><?= $bqr [title]?></a></li> [/e:loop] <?php } else if ( $islast ==1 and $bclassid !=0) //终极栏目,没有父栏目,则不输出 { ?> [e:loop={ "select * from phome_enewsclass where bclassid='" . $bclassid . "'" ,24,24,1}] <?php $classurl =sys_ReturnBqClassname( $bqr ,9); //取得栏目地址 $class = "" ; if ( $GLOBALS [navclassid]){ if ( $bqr [classid]== $GLOBALS [navclassid]) { $class = "on" ; }} ?> <li><a href= "<?=$bqsr[classurl]?>" class = "<?=$class?>" ><?= $bqr [classname]?></a></li> [/e:loop] <?php } else { ?> [e:loop={ "select * from phome_enewsclass where bclassid='" . $GLOBALS [navclassid]. "'" ,24,24,1}] <?php $classurl =sys_ReturnBqClassname( $bqr ,9); //取得栏目地址 $class = "" ; if ( $GLOBALS [navclassid]){ if ( $bqr [classid]== $GLOBALS [navclassid]) { $class = "on" ; }} ?> <li><a href= "<?=$bqsr[classurl]?>" class = "<?=$class?>" ><?= $bqr [classname]?></a></li> [/e:loop] <?php } ?> </ul> </div> |