帝国cms后台系统两大调用方式,一种是万能标签,一种是灵动标签,灵动标签顾名思义,灵活。在帝国cms后台中,这两种方式的灵动标签也是用的最多的,下面是整理的灵动标签e:loop常用的调用。
灵动标签 (e:loop) 格式
[e:loop={栏目ID,显示条数,操作类型,只显示有标题图片,附加SQL条件,显示排序}]
模板代码内容
[/e:loop]
[e:loop={2,6,0,0}]
<li>
<span>[<?=date('m-d',$bqr[newstime])?>]</span><a href="<?=$bqsr[titleurl]?>" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" target="_blank" title="<?=$bqr[title]?>"><?=esub($bqr[title],42,'...')?></a>
</li>
[/e:loop]
说明:调用栏目ID=2的前6条信息,其中标题可以用<?=$bqr[title]?>,也可以截取字符数,用<?=esub($bqr[title],42,’…’)?>,时间完整格式为:<?=date(‘Y-m-d’,$bqr[newstime])?>一、灵动标签调用指定栏目的前6条信息
二、灵动标签调用新闻数据库表news中的前5条信息
[e:loop={'news',5,18,0}]
<li><a href="<?=$bqsr[titleurl]?>" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" title="<?=$bqr[title]?>" target="_blank">
标题:<?=$bqr[title]?>
图片:<img src="<?=$bqr[titlepic]?>"></a>
简介:<?=$bqr[smalltext]?>
</li>
[/e:loop]
[e:loop={'news',5,18,1}]
<li><a href="<?=$bqsr[titleurl]?>" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" title="<?=$bqr[title]?>" target="_blank"><img src="<?=$bqr[titlepic]?>" /></a></li>
[/e:loop]
说明:第四个参数,1表示只显示有标题图片三、灵动标签调用新闻数据库表news中前5条带标题图的信息
四、灵动标签调用并且判断是否今日发表的,如果是,在标题后面添加new字样的图片
[e:loop={1,5,0,0}]
<?
$newimg="";
if(date("m-d",$bqr[truetime])==date("m-d"))
{
$newimg="<img src='[!--news.url--]skin/gh/images/new.gif'>";
}
?>
<li><a href="<?=$bqsr[titleurl]?>" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" target="_blank" title="<?=$bqr[title]?>"><?=$bqr[title]?></a><?=$newimg?></li>
[/e:loop]
五、灵动标签调用news新闻数据库表: 2条信息+有标题图+二级头条说明:调用栏目id为1的前5条信息,如果为当前日期,就显示skin/gh/images/目录下的new.gif图片,变量用<?=$newimg?>表示
[e:loop={'news',2,22,1,'firsttitle=2'}]
<li><a href="<?=$bqsr[titleurl]?>" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" title="<?=$bqr[title]?>" target="_blank"><i><img src="<?=$bqr[titlepic]?>"></i>
<h2><?=$bqr[title]?></h2>
<span><?=$bqsr[classname]?></span> </a> </li>
[/e:loop]
六、灵动标签调用标题中含有关键字词的信息说明:附加SQL条件为firsttitle=2,表示只调用二级头条信息,除了firsttitle表示头条外,还有置顶信息为istop,推荐信息为isgood
[e:loop={'news',10,18,0,"title like '%$navinfor[keyboard]%'",''}]
<li><a href="<?=$bqsr['titleurl']?>" rel="external nofollow" rel="external nofollow" target="_blank"><?=esub($bqr[title],24)?></a></li>
[/e:loop]
1、灵动标签调用广告分类ID1下面的3张图片七、灵动标签调用广告
[e:loop={"select picurl,url,target from {$dbtbpre}enewsad where classid=1 order by adid desc limit 3",0,24,0}]
<a href="<?=$bqr[url]?>" rel="external nofollow" rel="external nofollow" target="_blank"><img src="<?=$bqr[picurl]?>"></a>
[/e:loop]
[e:loop={"select picurl from {$dbtbpre}enewsad where adid=3 ",0,24,0}]
<img src="<?=$bqr[picurl]?>">
[/e:loop]
3、灵动标签调用指定广告ID带链接图片2、灵动标签调用指定广告ID调用图片
[e:loop={"select url,picurl from {$dbtbpre}enewsad where adid=3 ",0,24,0}]
<a href="<?=$bqr[url]?>" rel="external nofollow" rel="external nofollow" target="_blank"><img src="<?=$bqr[picurl]?>"></a>
[/e:loop]
1、文字链接八、灵动标签调用友情链接
[e:loop={'select lurl,lname from [!db.pre!]enewslink where checked=1 order by myorder',20,24,0}]
<li><a href="<?=$bqr[lurl]?>" rel="external nofollow" rel="external nofollow" target="_blank"><?=$bqr[lname]?></a></li>
[/e:loop]
[e:loop={'select lurl,lpic from [!db.pre!]enewslink where checked=1 order by myorder',20,24,0}]
<li><a href="<?=$bqr[lurl]?>" rel="external nofollow" rel="external nofollow" target="_blank" ><img src="<?=$bqr[lpic]?>"></a></li>
[/e:loop]
九、灵动标签调用所有栏目的名称以及图片2、图片链接
[e:loop={"select classid,classname,classimg from {$dbtbpre}enewsclass where bclassid=0 order by myorder,classid desc limit 12",0,24,0}]
<?php
$classurl=sys_ReturnBqClassname($bqr,9);//取得栏目地址
?>
<li><a href="<?=$classurl?>" rel="external nofollow" target="_blank"><img src="<?=$bqr[classimg]?>"></a><?=$bqr[classname]?></li>
[/e:loop]
[e:loop={"select * from [!db.pre!]enewstags order by num DESC limit 30",0,24,0}]
<?
echo '<li><a href="'.$public_r[newsurl].'e/tags/?tagname='.urlencode($bqr['tagname']).'" rel="external nofollow" >'.$bqr['tagname'].'<span class="tag-count"> ('.$bqr['num'].')</span></a></li>';
?>
[/e:loop]
说明:调用30条标签信息,标签地址为tagname,并且统计标签数量十、灵动标签调用tags
十一、灵动标签调用上一篇,下一篇
[e:loop={"select * from [!db.pre!]ecms_news where id<'$navinfor[id]' and classid='$navinfor[classid]' order by id desc limit 1",1,24,0}]
上一篇:<li><a href="<?=$bqsr[titleurl]?>" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" title="上一篇:<?=$bqr[title]?>" target="_blank"><?=$bqr[title]?></a></li>
[/e:loop]
[e:loop={"select * from [!db.pre!]ecms_news where id>'$navinfor[id]' and classid='$navinfor[classid]' order by id limit 1",1,24,0}]
下一篇:<li><a href="<?=$bqsr[titleurl]?>" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" title="下一篇<?=$bqr[title]?>" target="_blank"><?=$bqr[title]?></a></li>
[/e:loop]
十二、灵动标签随机调用
[e:loop={"select titleurl,title from [!db.pre!]ecms_news order by rand() desc limit 10",0,24,0}]
<li><a href="<?=$bqsr['titleurl']?>" rel="external nofollow" rel="external nofollow" target="_blank"><?=$bqr['title']?></a></li>
[/e:loop]
1.本站大部分内容均收集于网络!若内容若侵犯到您的权益,请发送邮件至:[email protected],我们将第一时间处理!
2.资源所需价格并非资源售卖价格,是收集、整理、编辑详情以及本站运营的适当补贴,并且本站不提供任何免费技术支持
3.所有资源仅限于参考和学习,版权归原作者所有,更多请阅读网站声明。