当前栏目高亮
<ul class="clearfix"> <li><a href="[!--news.url--]" title="首页">首页</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);//取得栏目地址 $class="";
if($GLOBALS[navclassid]){ $fcr=explode('|',$class_r[$GLOBALS[navclassid]][featherclass]); $topbclassid=$fcr[1]?$fcr[1]:$GLOBALS[navclassid];//取得当前栏目的一级栏目ID if($bqr[classid]==$topbclassid) { $class="selected"; } } ?> <li class="<?=$class?>"><a href="<?=$classurl?>"><?=$bqr[classname]?></a></li> [/e:loop] </ul>
另外一种方法
公共header中
<li class="active" id="homeid"><a href="[!--news.url--]">首 页</a></li> [e:loop={'select classid,classname,classpath from [!db.pre!]enewsclass where bclassid=0 and showclass=0 order by myorder',0,24,0}] <li id="cid<?=$bqr[classid]?>"><a href="<?=$public_r[newsurl]?><?=$bqr[classpath]?>" target="_self" ><?=$bqr[classname]?></a></li> [/e:loop]
首页中
直接调用header
其他页面调用header的下面加上
<script type="text/javascript"> var homeid = document.getElementById('homeid'); var myid = document.getElementById('cid[!--self.classid--]'); myid.className = 'active'; homeid.className = ''; </script>