帝国CMS模板灵动标签调用父子栏目连接和名称导航

方法1、
调用所有(循环导航)

e:loop={"select classpath,classname,classid,bclassid from [!db.pre!]enewsclass where bclassid='0' order by myorder ASC",100,24,0}]
    <div class="sitemap">
<h3><a href='<?=$public_r['newsurl'].$bqr['classpath']?>'><?=$bqsr[classname]?></a></h3>    
<ul>    
<?php
    $dh=$empire->query("select classpath,classname from  {$dbtbpre}enewsclass where bclassid='".$bqr['classid']."'  order by myorder ASC");   
    while($dhr=$empire->fetch($dh)) {
?>    
<li><a href='<?=$public_r['newsurl'].$dhr['classpath']?>'><?=$dhr[classname]?></a></li>
<?php
     }
?> 
</ul></div>
  [/e:loop]

方法2、
调用所有(循环导航)

[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);//取得栏目地址
$style="";
if($GLOBALS[navclassid])
{
$fcr=explode('|',$class_r[$GLOBALS[navclassid]][featherclass]);
$topbclassid=$fcr[1]?$fcr[1]:$GLOBALS[navclassid];//取得当前栏目的一级栏目ID
if($bqr[classid]==$topbclassid)
{
$style="current-menu-item";
}
}
?>
<li class="<?=$style?>"><a href="<?=$classurl?>"><?=$bqr[classname]?></a>
<ul><li class='litop'></li>
  <?php
    //取得栏目下的子栏目       
    $newsclass=$empire->query("select classid,classname from ".$dbtbpre."enewsclass where bclassid=".$bqr[classid]." order by myorder,classid asc limit 11");
 while($classr=$empire->fetch($newsclass))
    {  
    $classrurl=sys_ReturnBqClassname($classr,9); //取得子栏目地址
        ?>
 <li><a href="<?=$classrurl?>"><?=$classr[classname]?></a></li>
  <?php
    }
    ?>
  
</ul>
</li>
[/e:loop]

注释:

1、bclassid=’0′ 0为所有栏目
2、调用指定栏目  修改上面的bclassid=’0’为指定栏目的ID(如:bclassid=’2′ 新闻栏目ID=2),这样时只显示一级栏目下的所有子栏目(不显示一级栏目)