<li class="<?=$public_r[home]?'active':''?>"><a href="[!--news.url--]">首页</a></li><li class="<?=$GLOBALS[navclassid]==0?'active':''?>"><a href="[!--news.url--]">首页</a></li><?php$ecms_bq_sql=sys_ReturnEcmsLoopBq('select classid,classname,classpath from [!db.pre!]enewsclass where bclassid=0 and showclass=0 order by myorder limit 8',20,24,0); $bqno=0;while($bqr=$empire->fetch($ecms_bq_sql)){$bqsr=sys_ReturnEcmsLoopStext($bqr);$bqno++;?><li class="dropdown"><a href="<?=$public_r[newsurl]?><?=$bqr[classpath]?>" data-toggle="dropdown" class="<?=currentPage($GLOBALS[navclassid],$bqr[classid])?>"><?=$bqr[classname]?><b class="fa fa-angle-down"></b></a><ul class="dropdown-menu nav_two"><?php$ecms_bq_sql2=sys_ReturnEcmsLoopBq("select classid,classname,classpath from [!db.pre!]enewsclass where bclassid='$bqr[classid]' order by myorder limit 5",20,24,0);$bqno2=0;while($bqr2=$empire->fetch($ecms_bq_sql2)){$bqsr2=sys_ReturnEcmsLoopStext($bqr2);$bqno2++;?><li><a href="<?=$public_r[newsurl]?><?=$bqr2[classpath]?>"><?=$bqr2[classname]?></a></li><?php}?></ul></li><?php}?>
两种方式判断首页高亮,其中使用 $GLOBALS[navclassid] 来判断当前栏目的ID
如果是"0",说明当前栏目没有ID,那么肯定就是首页了。
使用灵动标签,循环输出属于根目录下的一级栏目。
e\class\userfun.php里添加自定义函数:
function currentPage($classid,$thisid){global $class_r;$fr=explode('|',$class_r[$classid][featherclass]);$topbclassid=$fr[1]?$fr[1]:$classid;if ($topbclassid==$thisid) {echo "on";}else {}}