帝国cms列表页获取父级栏目地址和父级栏目下所有子栏目

<div class="catleader minicat">
          <ul class="sub-category">
            <?php
             $bclassid = $class_r[$GLOBALS[navclassid]][bclassid]; //获取当前⽗栏⽬ID
             $cr['classid']=$class_r[$GLOBALS[navclassid]][bclassid];
             $bclassurl=sys_ReturnBqClassname($cr,9);
            >
            <li class="cat-item"> <a href="<?=$bclassurl?>">全部</a> </li>  
            [e:loop={"select classid,classname from {$dbtbpre}enewsclass where bclassid='$bclassid' order by myorder,classid asc",0,24,0}]
                        <?
                          $classurl=sys_ReturnBqClassname($bqr,9);//取得栏⽬地址
                          $on="";
                          if($bqr[classid]==$GLOBALS[navclassid])//当前栏⽬ID
                          {
                             $on="current-cat";
                          }
                        >
              <li class="cat-item  <?=$on?>"> <a href="<?=$classurl?>"><?=$bqr[classname]?></a> </li>       
          [/e:loop]
          </ul>
        </div>

<?php
             $bclassid = $class_r[$GLOBALS[navclassid]][bclassid]; //获取当前⽗栏⽬ID
             if($bclassid!=0){
                 $cr['classid']=$class_r[$GLOBALS[navclassid]][bclassid];
                 $bclassurl=sys_ReturnBqClassname($cr,9);
              }else{
                 //⽗级栏⽬
                 $bclassurl=sys_ReturnBqClassUrl($class_r[$GLOBALS[navclassid]]);
                 $bclassid=$GLOBALS[navclassid];
              }
            >
               <li ><a  href="<?=$bclassurl;?>" id="nav<?=$bclassid?>">全部</a></li>              
               [e:loop={"select * from `[!db.pre!]enewsclass` where bclassid='$bclassid' order by myorder,classid asc ",0,24,0,0,0}]                  
                   <li><a href="<?=$bqsr[classurl]?>" id="nav<?=$bqr[classid]?>"><?=$bqr[classname]?></a></li>
               [/e:loop]
 <script>
 $(document).ready(function(){  
  $("#nav[!--self.classid--]").addClass("active"); 
 });
</script>