帝国cms调用别的cms数据库表中的数据
帝国cms调用别的cms数据库表中的数据 以dz论坛为例子
调用论坛最新10个帖子
[e:loop={"select tid,subject from cdb_threads order by tid desc limit 10",10,24,0}]
<?=$bqr[tid]?>
<?=sub($bqr[subject],0,40,false)?>
[/e:loop]
调用论坛10个精华帖子,按顺序排列:
加上了 where digest <>0 也就是选择带有digest的帖子
[e:loop={"select tid,subject from cdb_threads where digest <>0 order by tid desc limit 10",10,24,0}]
<?=$bqr[tid]?>
<?=sub($bqr[subject],0,40,false)?>
[/e:loop]
调用论坛10个访问最多的帖子,按访问顺序排列:
[e:loop={"select tid,subject from cdb_threads order by views desc limit 10",10,24,0}]
<?=$bqr[tid]?>
<?=$bqr[subject]?>
[/e:loop]
论坛排行:
fid,name,threads 是dz论坛数据表cdb_forums 中的三个字段,分别代表:论坛板块id,论坛板块名,论坛板块内的帖子
调用cdb_forums这个数据表中的id,name这两个数据,并且按照threads的多少排列;
[e:loop={"select fid,name from cdb_forums order by threads desc limit 10",10,24,0}]
<?=$bqr[fid]?>
<?=$bqr[name]?>
[/e:loop]
调用uchome显示会员头像
[e:loop={"select uid,username from uchome_space order by credit desc limit 9",9,24,0}]
<?=$bqr[uid]?>
<?=$bqr[username]?>
[/e:loop]
万能标签:
热门会员头像,最新日志,最新话题,记录
调用论坛最新信息
[ecmsinfo]'select subject as title,tid as id from cdb_threads order by tid desc limit 10',0,30,0,24,7,0[/ecmsinfo]
调用特定主题的帖子信息
[ecmsinfo]'select subject as title,tid as id from discuz5.cdb_threads where fid=这里为要调用的主题帖子内容的FID order by tid desc limit 10',0,30,0,24,7,0[/ecmsinfo]
调用多个板块的帖子
[ecmsinfo]'select subject as title,tid as id from discuz5.cdb_threads where fid=数字 or fid=数字 order by tid desc limit 10',0,30,0,24,7,0[/ecmsinfo]