电脑技术学习

帝国CMS怎样循环调用子栏目

admin
一、例子1

指定一个大栏目ID

[e:loop={"select * from [!db.pre!]enewsclass where classid in(1)",10,24,0}]
 <a href="/<?=$bqr[classpath]?>"><?=$bqr[classname]?></a>|<?=$bqr[classid]?>|<?=$bqr[tbname]?>
 
<ul>
<?php
$ecms_bq_sql1=sys_ReturnEcmsLoopBq("select * from phome_enewsclass where bclassid in($bqr[classid])",10,24,0);
$bqno1=0;
while($bqr1=$empire->fetch($ecms_bq_sql1))
{
        $bqsr1=sys_ReturnEcmsLoopStext($bqr1);
        $bqno++;
        ?>
             <a href="/<?=$bqr1[classpath]?>"><?=$bqr1[classname]?></a>|<?=$bqr1[classid]?>|<?=$bqr1[tbname]?>
                         <ul>
              <?php
                      $ecms_bq_sql2=sys_ReturnEcmsLoopBq("select * from phome_enewsclass where bclassid in($bqr1[classid])",10,24,0);
                       $bqno2=0;
                        while($bqr2=$empire->fetch($ecms_bq_sql2))
                          {
                               $bqsr2=sys_ReturnEcmsLoopStext($bqr2);
                              $bqno2++;
                                      ?>
                             <a href="/<?=$bqr2[classpath]?>"><?=$bqr2[classname]?></a>|<?=$bqr2[classid]?>|<?=$bqr2[tbname]?>
                        
                                <?php 
                           } 
                             ?>   </ul>
              
 
<?php
}
?>
                        </ul>
         
[/e:loop]

二、例子2

调用本栏目下的 且高亮

[e:loop={"select classid,classname,classpath from [!db.pre!]enewsclass where bclassid = '".$class_r[$GLOBALS[navclassid]][bclassid]."' order by classid",0,24,0}]
<?
$class="";
if($GLOBALS[navclassid]==$bqr[classid])
$class="current";
{
?>
<li class="<?=$class?>">
<?=$bqr[num]?>
<a href="<?=$public_r[newsurl]?><?=$bqr[classpath]?>" target="_self">
<?=$bqr[classname]?>
</a></li>
<?php
}
?>
[/e:loop]

三、例子三 

全部调用 且 高亮

[e:loop={'select classid,classname,classpath,wburl from [!db.pre!]enewsclass where bclassid=0 and showclass=0 order by myorder limit 9',0,24,0}]
        <li>
<a href="<?php
if(empty($bqr[wburl]))
{
       echo $public_r[newsurl].$bqr[classpath];
} else {
       echo $bqr[wburl];
}
?>" title="<?=$bqr[classname]?>" id="cid<?=$bqr[classid]?>" <?=currentPage($GLOBALS[navclassid],$bqr[classid])?> target="_self"><?=$bqr[classname]?></a></li>
[/e:loop]
    </ul>
  </div>
 
  <ul class="subnav">
[e:loop={"select classid,classname,classpath from [!db.pre!]enewsclass where bclassid = '".$class_r[$GLOBALS[navclassid]][bclassid]."' order by classid",0,24,0}]
<?
$class="";
if($GLOBALS[navclassid]==$bqr[classid])
$class="current";
{
?>
<li class="<?=$class?>">
<?=$bqr[num]?>
<a href="<?=$public_r[newsurl]?><?=$bqr[classpath]?>" target="_self">
<?=$bqr[classname]?>
</a></li>
<?php
}
?>
[/e:loop]