国产探花免费观看_亚洲丰满少妇自慰呻吟_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數據庫的所有數據,上面只是舉了幾個例子。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 方山县| 通城县| 筠连县| 清丰县| 云林县| 合阳县| 和平区| 滨州市| 海伦市| 合山市| 黑水县| 旬邑县| 新竹县| 柏乡县| 中牟县| 汕尾市| 无棣县| 黄骅市| 元谋县| 马鞍山市| 沂南县| 万全县| 兴安县| 墨玉县| 福清市| 武汉市| 平谷区| 年辖:市辖区| 扬州市| 毕节市| 武鸣县| 文登市| 塔河县| 汾西县| 汉沽区| 仁化县| 桦甸市| 新蔡县| 新兴县| 祥云县| 巨鹿县|