封面列表页用灵动调用当前栏目及子栏目(3级栏目)代码
思良:终于找到了,最近在改版,想在封面和列表页调用当前栏目和子栏目,找了半天,要不只能调用当前栏目,要不只能指定ID才行,下面代码可以实现了。10楼
<ul>
<?phpif( $class_r[$GLOBALS[navclassid]][bclassid]==0)
{
?>
[e:loop={"select * from [!db.pre!]enewsclass where classid='$GLOBALS[navclassid]'",10,24,1}]
<li><a href="/<?=$bqr[classpath]?>"><?=$bqr[classname]?></a>
<ul>
<?php
$ecms_bq_sql1=sys_ReturnEcmsLoopBq("select * from [!db.pre!]enewsclass where bclassid in($bqr[classid])",10,24,0);
$bqno1=0;
while($bqr1=$empire->fetch($ecms_bq_sql1))
{
$bqsr1=sys_ReturnEcmsLoopStext($bqr1);
$bqno++;
?>
<li> <a href="/<?=$bqr1[classpath]?>"><?=$bqr1[classname]?></a>
<ul>
<?php
$ecms_bq_sql2=sys_ReturnEcmsLoopBq("select * from [!db.pre!]enewsclass where bclassid in($bqr1[classid])",10,24,0);
$bqno2=0;
while($bqr2=$empire->fetch($ecms_bq_sql2))
{
$bqsr2=sys_ReturnEcmsLoopStext($bqr2);
$bqno2++;
?>
<li> <a href="/<?=$bqr2[classpath]?>"><?=$bqr2[classname]?></a></li>
<?php
}
?> </ul>
</li>
<?php
}
?>
</ul>
</li>
[/e:loop]
<?php
}
else
{
?>
[e:loop={"select * from [!db.pre!]enewsclass where classid='$GLOBALS[navclassid]'",10,24,1}]
<ul>
<?php
$ecms_bq_sql1=sys_ReturnEcmsLoopBq("select * from [!db.pre!]enewsclass where bclassid in($bqr[bclassid])",10,24,0);
$bqno1=0;
while($bqr1=$empire->fetch($ecms_bq_sql1))
{
$bqsr1=sys_ReturnEcmsLoopStext($bqr1);
$bqno++;
?>
<li> <a href="/<?=$bqr1[classpath]?>"><?=$bqr1[classname]?></a>
<ul>
<?php
$ecms_bq_sql2=sys_ReturnEcmsLoopBq("select * from [!db.pre!]enewsclass where bclassid in($bqr1[classid])",10,24,0);
$bqno2=0;
while($bqr2=$empire->fetch($ecms_bq_sql2))
{
$bqsr2=sys_ReturnEcmsLoopStext($bqr2);
$bqno2++;
?>
<li> <a href="/<?=$bqr2[classpath]?>"><?=$bqr2[classname]?></a></li>
<?php
}
?> </ul>
</li>
<?php
}
?>
</ul>
[/e:loop]
<?php
}
?>
</ul> 原文:http://bbs.phome.net/ShowThread/?forumid=31&threadid=115077