帝国cms随机调用6个顶级栏目
[e:loop={'select classname, classpath from [!db.pre!]enewsclass where bclassid in (0) order by rand() desc limit 6',0,24,0}]
<li><a href="/<?=$bqr[classpath]?>"><?=$bqr[classname]?></a></li>
[/e:loop]
limit 6:控制调用栏目的个数。
面的in (0) 就是调用调用顶级栏目了。仔细查看帝国CMS的phome_enewsclass数据库,就会发现如果是顶级栏目, bclassid就是0。如果是子栏目 bclassid 就显示上级栏目ID号。
|