代码如下
<ul class="uk-navbar-nav">
<?php
$topbclassid=0;
if($GLOBALS[navclassid]){
$temp=explode('|',$class_r[$GLOBALS[navclassid]][featherclass]);
$topbclassid=$temp[1]?$temp[1]:$GLOBALS[navclassid];//取得当前栏目的一级栏目ID
}
echo '<li '.($topbclassid==0?"class='uk-active'":'').'><a href="/">网站首页</a></li>';
$sql=$empire->query("select * from {$dbtbpre}enewsclass where bclassid=0 order by myorder limit 12");
while($bqr=$empire->fetch($sql))
{
$sql2=$empire->query("select * from {$dbtbpre}enewsclass where bclassid=$bqr[classid] order by myorder limit 10");
echo '<li'.($topbclassid==$bqr[classid]?" class='uk-active'":'').'><a href="'.sys_ReturnBqClassname($bqr,9).'">'.$bqr['classname'].'</a>';
$result=[];
while($bqr2=$empire->fetch($sql2))
{
$result[]= $bqr2;
}
while(list($key,$bqr2) = each($result)) //循环获取查询记录
{
if($key==0) echo '<div class="uk-navbar-dropdown"><ul class="uk-nav uk-navbar-dropdown-nav">';
echo '<li'.($GLOBALS[navclassid]==$bqr2[classid]?" class='uk-active'":'').'><a href="'.sys_ReturnBqClassname($bqr2,9).'">'.$bqr2['classname'].'</a>';
if($key==(count($result)-1)) echo '</ul></div>';
}
echo '</li>';
}
?>
</ul>