代码中,
$Fclassid = 1;//父栏目ID
$SelectClassStyle = 'current';//当前选中时的样式

<?php
//父栏目ID
$Fclassid = 1;
$SelectClassStyle = 'current';

// 查询一级菜单
$sql = $empire->query("select classid, sonclass, classname, islast, islist from {$dbtbpre}enewsclass where bclassid=$Fclassid and showclass=0 order by myorder asc");
if($Fclassid == $GLOBALS['navclassid']){$FclassStyle=$SelectClassStyle;}else{$FclassStyle='';}
?>
 <li class="<?=$FclassStyle?>"><a href="[!--news.url--]<?=$class_r[$Fclassid]['classpath']?>/ ">全部</a></li>
<?php
while ($primaryMenu = $empire->fetch($sql)) {
    $classUrl = sys_ReturnBqClassname($primaryMenu, 9);
    $topClass = '';

    // 判断是否为当前菜单
    if ($class_r[$GLOBALS['navclassid']]['classid'] == $primaryMenu['classid']) {
        $topClass = $SelectClassStyle;
    }
    
?>
<li class="<?=$topClass?>"><a href="<?=$classUrl?>"><?=$primaryMenu['classname']?></a></li>
<?}?>

<?php
//父栏目ID
$Fclassid = 1;
$SelectClassStyle = 'current';

// 查询一级菜单
$sql = $empire->query("select classid, sonclass, classname, islast, islist from {$dbtbpre}enewsclass where bclassid=$Fclassid and showclass=0 order by myorder asc");
if($Fclassid == $GLOBALS['navclassid']){$FclassStyle=$SelectClassStyle;}else{$FclassStyle='';}
?>
 <li class="<?=$FclassStyle?>"><a href="[!--news.url--]<?=$class_r[$Fclassid]['classpath']?>/ ">全部</a></li>
<?php 
while ($primaryMenu = $empire->fetch($sql)) {
    $classUrl = sys_ReturnBqClassname($primaryMenu, 9); 
    $topClass = '';

    // 判断是否为当前菜单
    if ($class_r[$GLOBALS['navclassid']]['classid'] == $primaryMenu['classid']) {
        $topClass = $SelectClassStyle;
    }
    
?>
<li class="<?=$topClass?>"><a href="<?=$classUrl?>"><?=$primaryMenu['classname']?></a></li>
<?}?>
<?php
//父栏目ID
$Fclassid = 1;
$SelectClassStyle = 'current';

// 查询一级菜单
$sql = $empire->query("select classid, sonclass, classname, islast, islist from {$dbtbpre}enewsclass where bclassid=$Fclassid and showclass=0 order by myorder asc");
if($Fclassid == $GLOBALS['navclassid']){$FclassStyle=$SelectClassStyle;}else{$FclassStyle='';}
?>
 <li class="<?=$FclassStyle?>"><a href="[!--news.url--]<?=$class_r[$Fclassid]['classpath']?>/ ">全部</a></li>
<?php 
while ($primaryMenu = $empire->fetch($sql)) {
    $classUrl = sys_ReturnBqClassname($primaryMenu, 9); 
    $topClass = '';

    // 判断是否为当前菜单
    if ($class_r[$GLOBALS['navclassid']]['classid'] == $primaryMenu['classid']) {
        $topClass = $SelectClassStyle;
    }
    
?>
<li class="<?=$topClass?>"><a href="<?=$classUrl?>"><?=$primaryMenu['classname']?></a></li>
<?}?>