帝国cms采集视频教程 帝国CMS灵动标签调用上一篇,下一篇方法

帝国CMS教程

1)动态调用上一篇下一篇链接

  1. <a href="[!--news.url--]e/public/GotoNext?classid=[!--classid--]&id=[!--id--]&enews=pre">上一篇</a> 动态调用上一篇链接
  2. <a href="[!--news.url--]e/public/GotoNext?classid=[!--classid--]&id=[!--id--]&enews=next">下一篇</a> 动态调用下一篇链接

2)运用灵动标签和SQl语句调用

上一篇链接:

  1. [e:loop={"select id,classid,newspath,filename,groupid,titleurl from [!db.pre!]ecms_".$class_r[$navinfor[classid]]['tbname']." where id<".$navinfor[id]." andclassid=".$navinfor[classid]." and checked=1 order by id desc limit 1",1,24,0}]
  2. <?php
  3. $titleurl=sys_ReturnBqTitleLink($bqr);
  4. echo $titleurl;
  5. [/e:loop]

下一篇链接:(把小于号改成大于号)

  1. [e:loop={"select id,classid,newspath,filename,groupid,titleurl from [!db.pre!]ecms_".$class_r[$navinfor[classid]]['tbname']." where id>".$navinfor[id]." andclassid=".$navinfor[classid]." and checked=1 order by id desc limit 1",1,24,0}]
  2. <?php
  3. $titleurl=sys_ReturnBqTitleLink($bqr);
  4. echo $titleurl;
  5. [/e:loop]

3)运用灵动标签调用,比较简洁的方式

  1. <!--上一篇-->
  2. [e:loop={'selfinfo',1,0,0,'id<'.$navinfor[id].'','id desc'}]
  3. <a href="<?php
  4. echo $bqsr[titleurl];
  5. $pre='true';
  6. ?>">上一篇:<?=$bqr[title]?>
  7. </a>
  8. [/e:loop]
  9. <?php
  10. if(empty($pre)){
  11. echo "上一篇:很抱歉没有了";
  12. }
  13. ?>
  14. <!--下一篇-->
  15. [e:loop={'selfinfo',1,0,0,'id>'.$navinfor[id].'','id asc'}]
  16. <a href="<?php
  17. echo $bqsr[titleurl];
  18. $next='true';
  19. ?>">下一篇:<?=$bqr[title]?>
  20. </a>
  21. [/e:loop]
  22. <?php
  23. if(empty($next)){
  24. echo "下一篇:很抱歉没有了";
  25. }
  26. ?>

4)控制上一篇下一篇标题字数截取30个字符为例

运用:<?=esub($bqr[title],30)?>

  1. <!--上一篇-->
  2. [e:loop={'selfinfo',1,0,0,'id<'.$navinfor[id].'','id desc'}]
  3. <a href="<?php
  4. echo $bqsr[titleurl];
  5. $pre='true';
  6. ?>">上一篇: <?=esub($bqr[title],30)?></a>
  7. [/e:loop]
  8. <?php
  9. if(empty($pre)){
  10. echo "上一篇:很抱歉没有了";
  11. }
  12. ?>
  13. <!--下一篇-->
  14. [e:loop={'selfinfo',1,0,0,'id>'.$navinfor[id].'','id asc'}]
  15. <a href="<?php
  16. echo $bqsr[titleurl];
  17. $next='true';
  18. ?>">下一篇:<?=esub($bqr[title],30)?>
  19. </a>
  20. [/e:loop]
  21. <?php
  22. if(empty($next)){
  23. echo "下一篇:很抱歉没有了";
  24. }
  25. ?>