实例2:在灵动标签内使用SQL
[e:loop={'select * from phome_ecms_news where classid=72 order by id DESC limit 6',6,24,0}],注意倒数第二个参数为24,才可以使用SQL。
[e:loop={'select * from [!db.pre!]ecms_news where classid=72 and type='开发商' order by id DESC limit 6',6,24,0}]
<li class="class1"> <a href='http://www.hkqipilang.acafa.com/' target=_blank title='<?=$bqr[title]?>'><?=$bqr[title]?></a>
<div class="top_div_myAcafa_u"><?=$bqr[address]?><br />业务范围: <?=$bqr[smalltext]?></div>
</li>
[/e:loop]
实例3:如果信息带有图片信息,则标题上带有图片标志
<!--最新300条中点击率最高的2条-->
[e:loop={'select * from (select a.id,a.title,a.newspath,a.newstime,b.classpath,b.classname,b.filetype,a.onclick,a.smalltext from '.$dbtbpre.'ecms_article as a,'.$dbtbpre.'enewsclass b where a.classid=b.classid and a.checked=1 order by a.newstime desc limit 200) as new300 order by new300.onclick desc limit 2',1,24,0}]
<li>
$newimg="";
$sql_good=$empire->query("select * from (select a.id,a.title,a.newspath,a.newstime,b.classpath,b.classname,b.filetype from ".$dbtbpre."ecms_article as a,".$dbtbpre."enewsclass b where a.classid=b.classid and a.checked=1 and a.isgood=1 order by a.onclick desc limit 12) as a1 order by length(a1.title) limit ".($good_pageSize*$good_limitsize).",".$good_limitsize);
$_i=$good_limitsize*$good_pageSize+1;
while($info=$empire->fetch($sql_good))
{
[e:loop={'select classid,classpath,classname from [!db.pre!]enewsclass where classid in ("47","48","49","50","51","52","53","54","55","103","112") order by classid',1,24,0}]
<div id="body_left_Pane2" class="body_left_Pane2">
<div id="body_left_Pane2_title" class="body_left_Pane2_title">
<span><h4><a href="[!--news.url--]<?=$bqr[classpath]?>/" title="<?=$bqr[classname]?>"><?=$bqr[classname]?></a></h4></span>
<span></span><span></span>
<?php
$newimg="";
$sql=$empire->query("select classid,classpath,classname from ".$dbtbpre."enewsclass where bclassid=$bqr[classid] order by classid");
while($info=$empire->fetch($sql))
{?>
<span><a href="[!--news.url--]<?=$info[classpath]?>/" title="<?=$info[classname]?>"><?=$info[classname]?></a></span>
<?php
}
?>
</div>
<div id="body_left_Pane2_body" class="body_left_Pane2_body">
<div id="body_left_Pane2_body_left" class="body_left_Pane2_body_left">
<div id="body_left_Pane2_body_left_title" class="body_left_Pane2_body_left_title">
<?php
$newimg="";
$sql=$empire->query("select a.*,b.filetype,b.classpath,b.classname from ".$dbtbpre."ecms_article as a,".$dbtbpre."enewsclass b where a.classid=b.classid and a.checked=1 and a.firsttitle=1 and length(a.titlepic)>3 and a.classid in (select classid from ".$dbtbpre."enewsclass where bclassid=$bqr[classid]) order by a.newstime desc limit 1");
while($info=$empire->fetch($sql))
{?>
<div id="body_left_Pane2_body_left_title_pic" class="body_left_Pane2_body_left_title_pic">
<img src="<?=$info[titlepic]?>" title="<?=$info[title]?>" width="80" height="60" />
</div>
<div id="body_left_Pane2_body_left_title_right" class="body_left_Pane2_body_left_title_right">
<h5><a href="[!--news.url--]<?=$info[classpath].'/'.$info[newspath].'/'.$info[id].$info[filetype ]?>" target="_blank" title="<?$info[title]?>"><?=sub($info[title],0,20,false)?></a></h5>
<?=sub($info[smalltext],0,100,false)?>……
</div>
<?php
}
?>
</div>
<div id="body_left_Pane2_body_left_body" class="body_left_Pane2_body_left_body">
<ul>
<?php
$newimg="";
$sql=$empire->query("select a.id,a.title,a.newspath,a.newstime,b.classpath,b.classname,b.filetype from ".$dbtbpre."ecms_article as a,".$dbtbpre."enewsclass b where a.classid=b.classid and a.checked=1 and a.classid in (select classid from ".$dbtbpre."enewsclass where bclassid='$bqr[classid]' order by classid) order by a.onclick desc,a.newstime desc limit ".$limitsize);
while($info=$empire->fetch($sql))
{
if (date("y-m-d",$info[newstime])==date("y-m-d"))
{$newimg="<font color=red>".date("m-d",$info[newstime])."</font>";}
else
{$newimg=date("m-d",$info[newstime]);}
?>
<li>
<a href="[!--news.url--]<?=$info[classpath].'/'.$info[newspath].'/'.$info[id].$info[filetype ]?>" target="_blank" title="<?=$info[title]?>"><?=sub($info[title],0,30,false)?></a>
</li>
<?php
}
?>
</ul>
</div>
</div>
<div id="body_left_Pane2_body_right" class="body_left_Pane2_body_right">
<ul>
<?php
$newimg="";
$sql=$empire->query("select a.id,a.title,a.newspath,a.newstime,b.classpath,b.classname,b.filetype,b.classid as b_id from ".$dbtbpre."ecms_article as a,".$dbtbpre."enewsclass b where a.classid=b.classid and a.checked=1 and a.classid in (select classid from ".$dbtbpre."enewsclass where bclassid='$bqr[classid]' order by classid) order by a.newstime desc limit ".$limitNewSize);
while($info=$empire->fetch($sql))
{
if (get_date(date("y-m-d"),date("y-m-d",$info[newstime]))<1)
{$newimg="<img src='[!--news.url--]face/image/new.gif' width='25' height='13' title='".date("y-m-d",$info[newstime])."'/>";}
else
{$newimg="";}