帝国ECMS教程:上一篇下一篇自定义综合代码


一: 动态调用上一篇 下一篇链接

1 <a href="[!--news.url--]e/public/GotoNext?classid=[!--classid--]&id=[!--id--]&enews=pre">上一篇</a>

1 <a href="[!--news.url--]e/public/GotoNext?classid=[!--classid--]&id=[!--id--]&enews=next">下一篇</a>

二: 运用灵动标签和SQl语句调用

上一篇链接:

1 [e:loop={"select id,classid,newspath,filename,groupid,titleurl from [!db.pre!]ecms_".$class_r[$navinfor[classid]]['tbname']." where id<".$navinfor[id]." and classid=".$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]." and classid=".$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]

三: 运用灵动标签调用,比较简洁的方式

01 <!--上一篇-->

02 [e:loop={'selfinfo',1,0,0,'id<'.$navinfor[id].'','id desc'}]

03 <a href="<?php 

04 echo $bqsr[titleurl];

05 $pre='true';

06 ?>">上一篇:<?=$bqr[title]?>

07 </a>

08 [/e:loop]

09 <?php 

10 if(empty($pre)){

11 echo "上一篇:很抱歉没有了";

12 }

13 ?>

14 

15 <!--下一篇-->

16 [e:loop={'selfinfo',1,0,0,'id>'.$navinfor[id].'','id asc'}]

17 <a href="<?php 

18 echo $bqsr[titleurl];

19 $next='true';

20 ?>">下一篇:<?=$bqr[title]?>

21 </a>

22 [/e:loop]

23 <?php 

24 if(empty($next)){

25 echo "下一篇:很抱歉没有了";

26 }

27 ?>

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

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

01 <!--上一篇-->

02 [e:loop={'selfinfo',1,0,0,'id<'.$navinfor[id].'','id desc'}]

03 <a href="<?php 

04 echo $bqsr[titleurl];

05 $pre='true';

06 ?>">上一篇: <?=esub($bqr[title],30)?></a>

07 [/e:loop]

08 <?php 

09 if(empty($pre)){

10 echo "上一篇:很抱歉没有了";

11 }

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 ?>">下一篇:<?=esub($bqr[title],30)?>

20 </a>

21 [/e:loop]

22 <?php 

23 if(empty($next)){

24 echo "下一篇:很抱歉没有了";

25 }

26 ?>


« 
» 
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3