帝國(guó)CMS的標(biāo)簽的SQL查詢調(diào)用支持調(diào)用mysql數(shù)據(jù)庫的所有數(shù)據(jù):
用靈動(dòng)標(biāo)簽調(diào)用外部數(shù)據(jù): |
例一:調(diào)用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的數(shù)據(jù)庫名稱。 limit 10為顯示貼子數(shù)量。 如果用偽靜態(tài)地址可以用:/bbs/thread-<?=$bqr[tid]?>-1-1.html 如果指定單個(gè)版塊的貼子,SQL用:select tid,subject,dateline from discuzdb.cdb_threads where fid=版塊ID order by tid desc limit 10 如果指定多個(gè)版塊的貼子,SQL用:select tid,subject,dateline from discuzdb.cdb_threads where fid in (1,2,3) order by tid desc limit 10 |
例二:調(diào)用Discuz的最新貼子(含調(diào)用論壇版塊名) |
<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的數(shù)據(jù)庫名稱。 |
例三:調(diào)用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的數(shù)據(jù)庫名稱。 limit 10為顯示貼子數(shù)量。 如果用偽靜態(tài)地址可以用:/bbs/thread-<?=$bqr[tid]?>-1-1.html 如果指定單個(gè)版塊的貼子,SQL用:select tid,subject,dateline from discuzdb.pre_forum_thread where fid=版塊ID order by tid desc limit 10 如果指定多個(gè)版塊的貼子,SQL用:select tid,subject,dateline from discuzdb.pre_forum_thread where fid in (1,2,3) order by tid desc limit 10 |
例四:調(diào)用DiscuzX的最新貼子(含調(diào)用論壇版塊名) |
<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的數(shù)據(jù)庫名稱。 |
例五:調(diào)用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的數(shù)據(jù)庫名稱。 limit 10為顯示貼子數(shù)量。 如果用偽靜態(tài)地址可以用:/bbs/read-htm-tid-<?=$bqr[tid]?>.html 如果指定單個(gè)版塊的貼子,SQL用:select tid,subject,postdate from phpwinddb.pw_threads where fid=版塊ID order by tid desc limit 10 如果指定多個(gè)版塊的貼子,SQL用:select tid,subject,postdate from phpwinddb.pw_threads where fid in (1,2,3) order by tid desc limit 10 |
例六:調(diào)用PHPwind的最新貼子(含調(diào)用論壇版塊名) |
<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的數(shù)據(jù)庫名稱。 |
其他說明: |
1、帝國(guó)CMS的數(shù)據(jù)庫帳號(hào)要有select權(quán)限查詢對(duì)應(yīng)數(shù)據(jù)庫的表,才能讀取成功。 |
2、SQL調(diào)用支持調(diào)用mysql數(shù)據(jù)庫的所有數(shù)據(jù),上面只是舉了幾個(gè)例子。 |
|
|
|
|