簡介:帝國cms欄目頁隨機調用欄目內容
1.調用當前欄目下的內容
[e:loop={"select * from [!db.pre!]ecms_news where classid='$GLOBALS[navclassid]' order by rand() desc limit 12",12,24,0,'','newstime DESC'}]
<li><a target="_blank" href="<?=$bqsr['titleurl']?>"> <?=$bqr['title']?> </a></li>
[/e:loop]
2.根據當前欄目的id值來判斷調用
<?
if($navclassid==1){
?>
[e:loop={'select * from [!db.pre!]ecms_news where classid in(1) order by rand() desc limit 20',20,24,0}]
<li title="<?=$bqr['title']?>"><a target="_blank" href="<?=$bqsr['titleurl']?>"> <?=$bqr['title']?> </a></li>
[/e:loop]
<?php
}else if ($navclassid==2){
?>[e:loop={'select * from [!db.pre!]ecms_news where classid in(2) order by rand() desc limit 20',20,24,0}]
<li title="<?=$bqr['title']?>"><a target="_blank" href="<?=$bqsr['titleurl']?>"> <?=$bqr['title']?> </a></li>
[/e:loop]
<?
}
?>