高效率随机调用:
<?php
$num=$empire->num("select tagid from {$dbtbpre}enewstags");
$randnum=100;
$randids='';
$randdh='';
for($i=1;$i<=$randnum;$i++)
{
$randids.=$randdh.rand(1,$num);
$randdh=',';
}
?>
[e:loop={"select tagname,tagid from phome_enewstags where tagid in ($randids) limit $randnum",32,24,0}]
<a target="_blank" href="/tag/<?=$bqr['tagid']?>/" title="<?=$bqr['tagname']?>"><?=$bqr['tagname']?></a> |
[/e:loop]
代码这里,修改url以及样式即可使用,随机高效率代码
正常调用:
[e:loop={"select tagname,tagid from phome_enewstags limit 12 ",32,24,0}]
<a target="_blank" href="/e/tags/?tagname=<?=$bqr['tagname']?>" title="<?=$bqr['tagname']?>"><?=$bqr['tagname']?></a> |
[/e:loop]
随机调用:
[e:loop={"select tagname,tagid from phome_enewstags order by rand() limit 12 ",32,24,0}]
<a target="_blank" href="/e/tags/?tagname=<?=$bqr['tagname']?>" title="<?=$bqr['tagname']?>"><?=$bqr['tagname']?></a> |
[/e:loop]
内容页调用:
[e:loop={"select a.*,b.* from [!db.pre!]enewstags a LEFT JOIN [!db.pre!]enewstagsdata b ON a.tagid=b.tagid where b.classid='$navinfor[classid]' and b.id='$navinfor[id]' group by b.tagid order by a.num desc limit 10",0,24,0}]
<a href='<?=$public_r['newsurl']?>e/tags/?tagname=<?=$bqr['tagname']?>' title='<?=$bqr['num']?>个'><?=$bqr['tagname']?>(<?=$bqr['num']?>)</a>
[/e:loop]
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END
暂无评论内容