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] <? } ?> |