帝国cms优化设置 帝国CMS灵动标签使用案例&教程

帝国CMS教程

帝国cms灵动标签使用案例

1)灵动标签-调用友情链接

代码:

  1. <ul class="links_text">
  2. [e:loop={'select * from [!db.pre!]enewslink where checked=1 and lpic="" order by lid',20,24,0}]
  3. <li><a href="<?=$bqr[lurl]?>"><?=$bqr[lname]?></a></li>
  4. [/e:loop]
  5. </ul>

说明:本灵动标签是调用文字友情链接,需要图片友情链接的用户只需要简单修改即可。

2)灵动标签-栏目导航且当前栏目导航高亮显示

代码:

  1. <ul>
  2. <li><a href="/" title="首页" target="_self">首 页</a></li>
  3. [e:loop={'select classid,classname,classpath from [!db.pre!]enewsclass order by classid',0,24,0}]
  4. <li class="" id="cid<?=$bqr[classid]?>"><a href="<?=$public_r[newsurl]?><?=$bqr[classpath]?>" title="<?=$bqr[classname]?>" target="_self" ><?=$bqr[classname]?></a></li>
  5. [/e:loop]
  6. </ul>
  7. <script>
  8. var changeclass=window.document.getElementById('cid[!--self.classid--]');
  9. changeclass.className='active';
  10. </script>

说明:SQL语句自己研究下不多说,至于<li class="" id="cid<?=$bqr[classid]?>"> 是给li让系统自动获取当前栏目的id并且定义li的id,然后下面JS就是判断如果是当前ID 侧定义li的class是active;也就是changeclass.className='active';您可以把active改成您想要的CSS Class名称。

3)灵动标签-当天信息加New标志

代码:

  1. <ul>
  2. [e:loop={栏目ID,显示条数,操作类型,只显示有标题图片}]
  3. <?
  4. $newimg="";
  5. if(date("m-d",$bqr[truetime])==date("m-d"))
  6. {
  7. $newimg="<img src='New图片地址'>";
  8. }
  9. ?>
  10. <li>
  11. <a href="<?=$bqsr[titleurl]?>" target="_blank"><?=sub($bqr[title],0,10,false)?></a><?=$newimg?>
  12. </li>
  13. [/e:loop]
  14. </ul>

4)灵动标签-调用DZ,PW论坛帖子

调用Discuz最新贴子:cdb_是discuz的表前缀

代码:

  1. <table width="100%" border="0" cellspacing="1" cellpadding="3">
  2. [e:loop={"select tid,subject from cdb_threads order by tid desc limit 10",10,24,0}]
  3. <tr><td>
  4. <a href="/bbs/viewthread.php?tid=<?=$bqr[tid]?>" target="_blank"><?=$bqr[subject]?></a>
  5. </td></tr>
  6. [/e:loop]
  7. </table>

调用PHPwind最新贴子:pw_是phpwind的表前缀

代码:

  1. <table width="100%" border="0" cellspacing="1" cellpadding="3">
  2. [e:loop={"select tid,subject from pw_threads order by tid desc limit 10",10,24,0}]
  3. <tr><td>
  4. <a href="/bbs/read.php?tid=<?=$bqr[tid]?>" target="_blank"><?=$bqr[subject]?></a>
  5. </td></tr>
  6. [/e:loop]
  7. </table>

5)灵动标签-调用网站最新会员,头像+用户名+链接到空间

代码:

  1. <ul>
  2. [e:loop={'select userid as userid,truename as title,userpic as titlepic from [!db.pre!]enewsmemberadd order by userid desc limit 8',10,24,0}]
  3. <li><a href="/e/space/?userid=<?=$bqr[userid]?>" target="_blank"><img src="<?=$bqr[titlepic]?>" alt='<?=$bqr[title]?>' width="52" height="52" /><?=$bqr[title]?></a></li>
  4. [/e:loop]
  5. </ul>

调用说明:

用户ID:<?=$bqr[userid]?>

用户头像:<?=$bqr[titlepic]?>

用户名称:<?=$bqr[title]?>

6)灵动标签-调用最新DIGG顶的最多的文章

代码:

  1. [e:loop={'select * from [!db.pre!]ecms_news where checked=1 order by diggtop desc,id desc limit 8',10,24,0}]
  2. <li><a href="<?=$bqsr[titleurl]?>"><?=sub($bqr[title],0,30,false)?>]</a><span><small>点击:</small><?=$bqr[onclick]?></span> <span><small>顶:</small><?=$bqr[diggtop]?></span></li>
  3. [/e:loop]

7)灵动标签-调用最新最多评论文章

代码:

  1. [e:loop={'select * from [!db.pre!]ecms_news where checked=1 order by plnum desc,id desc limit 8',10,24,0}]
  2. <li> <small><a href="<?=$bqsr[titleurl]?>" class="title"><?=sub($bqr[title],0,30,false)?></a></small>
  3. <p><?=$bqr[smalltext]?></p>
  4. </li>
  5. [/e:loop]

8)灵动标签-调用最新最多评论文章

代码:

  1. [e:loop={'select classid,classname,classpath,wburl from [!db.pre!]enewsclass where bclassid=0 and showclass=0 order by myorder',0,24,0}]
  2. <li><a href="<?php
  3. if(empty($bqr[wburl]))
  4. {
  5. echo $public_r[newsurl].$bqr[classpath];
  6. } else {
  7. echo $bqr[wburl];
  8. }
  9. ?>" title="<?=$bqr[classname]?>" target="_self"><?=$bqr[classname]?></a></li>
  10. [/e:loop]

9)灵动标签-调用一周内信息点击排行

代码:

  1. [e:loop={'news',10,18,0,'newstime>UNIX_TIMESTAMP()-86400*7','onclick desc'}]
  2. <a href="<?=$bqsr[titleurl]?>" target="_blank"><?=$bqr[title]?></a><br>
  3. [/e:loop]

10)灵动标签-调用5级推荐的信息

代码:

  1. [e:loop={'news',10,18,0,'isgood=5'}]
  2. <a href="<?=$bqsr[titleurl]?>" target="_blank"><?=$bqr[title]?></a><br>
  3. [/e:loop]