[e:loop={"select classname,classpath from [!db.pre!]enewsclass where bclassid=0 order by classid ",0,24,0}] <a href="<?=$public_r[newsurl]?><?=$bqr[classpath]?>" title="<?=$bqr[classname]?>"><?=$bqr[classname]?></a> [/e:loop]
如果是顶级栏目,bclassid就是0;如果是子栏目,bclassid就显示上级栏目ID号。
下面我们改造下,使其调用所有一级(顶级)栏目导航,导航支持外部栏目,支持后台设定是否显示:
[e:loop={'select classid,classname,classpath,wburl from [!db.pre!]enewsclass where bclassid=0 and showclass=0 order by myorder',0,24,0}] <li><a href="<?php if(empty($bqr[wburl])) { echo $public_r[newsurl].$bqr[classpath]; } else { echo $bqr[wburl]; } ?>" title="<?=$bqr[classname]?>"><?=$bqr[classname]?></a></li> [/e:loop]