4.4 应用举例 猜你喜欢
来源:网络作者:站长
<div class="whitebg suiji"> <h2 class="side-title">猜你喜欢</h2> <ul> [e:loop={'selfinfo',10,0,0,'','rand()'}] <li><a target="_blank" href="<?=$bqsr['titleurl']?>"><?=$bqr['title']?></a></li> [/e:loop] </ul> </div>
<?php $randnum=10; //随机数量 $randids=''; $randdh=''; for($i=1;$i<=$randnum;$i++) { $randids.=$randdh.rand(1,100000); //1为最小ID,100000为最大ID $randdh=','; } ?> [e:loop={栏目ID,显示条数,操作类型,只显示有标题图片,"id in ($randids)"}] //模板代码内容 [/e:loop]
[e:loop={"select * from [!db.pre!]ecms_news order by rand() desc limit 10",0,24,0}] <li><a href="<?=$bqsr['titleurl']?>" target="_blank"><?=$bqr['title']?></a></li> [/e:loop]
你觉得文章内容怎么样