国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > CMS > Discuz > 正文

靈動標簽調用外部數據|如Discuz、DiscuzX、PHPwind

2024-07-09 22:55:07
字體:
來源:轉載
供稿:網友
用靈動標簽調用外部數據:
例一:調用Discuz的最新貼子

<table width="100%" border="0" cellspacing="1" cellpadding="3">
[e:loop={"select tid,subject,dateline from discuzdb.cdb_threads order by tid desc limit 10",10,24,0}]
<tr><td>
<a href="/bbs/viewthread.php?tid=<?=$bqr[tid]?>" target="_blank"><?=$bqr[subject]?></a> (<?=date('Y-m-d',$bqr[dateline])?>) 
</td></tr>
[/e:loop]
</table>

discuzdb.cdb_threads為Discuz的貼子表名,其中“discuzdb”為Discuz的數據庫名稱。
limit 10為顯示貼子數量。
如果用偽靜態地址可以用:/bbs/thread-<?=$bqr[tid]?>-1-1.html 
如果指定單個版塊的貼子,SQL用:select tid,subject,dateline from discuzdb.cdb_threads where fid=版塊ID order by tid desc limit 10
如果指定多個版塊的貼子,SQL用:select tid,subject,dateline from discuzdb.cdb_threads where fid in (1,2,3) order by tid desc limit 10
例二:調用Discuz的最新貼子(含調用論壇版塊名)

<table width="100%" border="0" cellspacing="1" cellpadding="3">
[e:loop={"select tid,subject,dateline,fid from discuzdb.cdb_threads order by tid desc limit 10",10,24,0}]
<?php
$fr=$empire->fetch1("select name from discuzdb.cdb_forums where fid='$bqr[fid]'");
?>
 
<tr><td>
[<?=$fr[name]?>] <a href="/bbs/viewthread.php?tid=<?=$bqr[tid]?>" target="_blank"><?=$bqr[subject]?></a> (<?=date('Y-m-d',$bqr[dateline])?>) 
</td></tr>
[/e:loop]
</table>

discuzdb.cdb_forums為Discuz的版塊表名,其中“discuzdb”為Discuz的數據庫名稱。
例三:調用DiscuzX的最新貼子

<table width="100%" border="0" cellspacing="1" cellpadding="3">
[e:loop={"select tid,subject,dateline from discuzdb.pre_forum_thread order by tid desc limit 10",10,24,0}]
<tr><td>
<a href="/bbs/forum.php?mod=viewthread&tid=<?=$bqr[tid]?>" target="_blank"><?=$bqr[subject]?></a> (<?=date('Y-m-d',$bqr[dateline])?>) 
</td></tr>
[/e:loop]
</table>

discuzdb.pre_forum_thread為DiscuzX的貼子表名,其中“discuzdb”為DiscuzX的數據庫名稱。
limit 10為顯示貼子數量。
如果用偽靜態地址可以用:/bbs/thread-<?=$bqr[tid]?>-1-1.html
如果指定單個版塊的貼子,SQL用:select tid,subject,dateline from discuzdb.pre_forum_thread where fid=版塊IDorder by tid desc limit 10
如果指定多個版塊的貼子,SQL用:select tid,subject,dateline from discuzdb.pre_forum_thread where fid in (1,2,3)order by tid desc limit 10
例四:調用DiscuzX的最新貼子(含調用論壇版塊名)

<table width="100%" border="0" cellspacing="1" cellpadding="3">
[e:loop={"select tid,subject,dateline,fid from discuzdb.pre_forum_thread order by tid desc limit 10",10,24,0}]
<?php
$fr=$empire->fetch1("select name from discuzdb.pre_forum_forum where fid='$bqr[fid]'");
?>
 
<tr><td>
[<?=$fr[name]?>] <a href="/bbs/forum.php?mod=viewthread&tid=<?=$bqr[tid]?>" target="_blank"><?=$bqr[subject]?></a> (<?=date('Y-m-d',$bqr[dateline])?>) 
</td></tr>
[/e:loop]
</table>

discuzdb.pre_forum_forum為DiscuzX的版塊表名,其中“discuzdb”為DiscuzX的數據庫名稱。
例五:調用PHPwind的最新貼子

<table width="100%" border="0" cellspacing="1" cellpadding="3">
[e:loop={"select tid,subject,postdate from phpwinddb.pw_threads order by tid desc limit 10",10,24,0}]
<tr><td>
<a href="/bbs/read.php?tid=<?=$bqr[tid]?>" target="_blank"><?=$bqr[subject]?></a> (<?=date('Y-m-d',$bqr[postdate])?>) 
</td></tr>
[/e:loop]
</table>

phpwinddb.pw_threads為phpwind的貼子表名,其中“phpwinddb”為phpwind的數據庫名稱。
limit 10為顯示貼子數量。
如果用偽靜態地址可以用:/bbs/read-htm-tid-<?=$bqr[tid]?>.html
如果指定單個版塊的貼子,SQL用:select tid,subject,postdate from phpwinddb.pw_threads where fid=版塊ID order by tid desc limit 10
如果指定多個版塊的貼子,SQL用:select tid,subject,postdate from phpwinddb.pw_threads where fid in (1,2,3)order by tid desc limit 10
例六:調用PHPwind的最新貼子(含調用論壇版塊名)

<table width="100%" border="0" cellspacing="1" cellpadding="3">
[e:loop={"select tid,subject,postdate,fid from phpwinddb.pw_threads order by tid desc limit 10",10,24,0}]
<?php
$fr=$empire->fetch1("select name from phpwinddb.pw_forums where fid='$bqr[fid]'");
?>

<tr><td>
[<?=$fr[name]?>] <a href="/bbs/read.php?tid=<?=$bqr[tid]?>" target="_blank"><?=$bqr[subject]?></a> (<?=date('Y-m-d',$bqr[postdate])?>) 
</td></tr>
[/e:loop]
</table>

phpwinddb.pw_forums為phpwind的版塊表名,其中“phpwinddb”為phpwind的數據庫名稱。
其他說明:
1、帝國CMS的數據庫帳號要有select權限查詢對應數據庫的表,才能讀取成功。
2、SQL調用支持調用mysql數據庫的所有數據,上面只是舉了幾個例子。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 彭水| 阿克苏市| 弥渡县| 高州市| 林周县| 奈曼旗| 通辽市| 靖边县| 横峰县| 麦盖提县| 东宁县| 会同县| 枣强县| 汪清县| 宁化县| 霍山县| 德阳市| 衡东县| 德安县| 进贤县| 泾源县| 得荣县| 连云港市| 启东市| 麻江县| 汪清县| 安龙县| 鸡东县| 宜章县| 永仁县| 库车县| 桂东县| 上栗县| 安徽省| 石景山区| 溧阳市| 晋州市| 泰顺县| 平果县| 囊谦县| 和龙市|