帝国cms内容页个性化用灵动标签sql调用上一篇和下一篇
一: 动态调用上一篇下一篇链接
上一篇 动态调用上一篇链接 下一篇 动态调用下一篇链接
二: 运用灵动标签和SQl语句调用
上一篇链接:
[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}]下一篇链接:(把小于号改成大于号)
[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}]三: 运用灵动标签调用,比较简洁的方式
[e:loop={'selfinfo',1,0,0,'id<'.$navinfor[id].'','id desc'}] ">上一篇:=$bqr[title]?> [/e:loop] [e:loop={'selfinfo',1,0,0,'id>'.$navinfor[id].'','id asc'}] ">下一篇:=$bqr[title]?> [/e:loop]四: 控制上一篇下一篇标题字数截取30个字符为例
运用:=esub($bqr[title],30)?>
[e:loop={'selfinfo',1,0,0,'id<'.$navinfor[id].'','id desc'}] ">上一篇: =esub($bqr[title],30)?> [/e:loop] [e:loop={'selfinfo',1,0,0,'id>'.$navinfor[id].'','id asc'}] ">下一篇:=esub($bqr[title],30)?> [/e:loop]以上是基本的灵动标签sql使用方法,根据自己站点来修改吧