国产999精品久久久久久-国产欧美综合一区二区三区-国产精品无码专区-亚洲色精品aⅴ一区区三区

 
售前咨詢QQ:QQ412395521
業務合作QQ:QQ627174919
位置:首頁 > 知新 > 帝國CMS > 模板制作

靈動標簽調用外部數據

時間:2011-06-14 09:53:29
帝國CMS的標簽的SQL查詢調用支持調用mysql數據庫的所有數據:
 
用靈動標簽調用外部數據:
例一:調用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=版塊ID order 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數據庫的所有數據,上面只是舉了幾個例子。
旗下其它產品:【帝國備份王】    【EBMA系統】    【帝國下載系統
Powered by EmpireCMS
版權所有 ©2002-2024 EmpireSoft Inc.