注明:如果你安裝在不同的數(shù)據(jù)庫,需要在sql中指定數(shù)據(jù)庫,我這邊是jtb,與公司的織夢dedecms不是安裝在同庫中。
調(diào)用圖文帖子的方法:
{dede:sql sql="SELECT jtb.pre_forum_threadimage.tid, jtb.pre_forum_threadimage.attachment, jtb.pre_forum_thread.tid, jtb.pre_forum_thread.fid, jtb.pre_forum_thread.subject FROM jtb.pre_forum_threadimage
LEFT JOIN jtb.pre_forum_thread ON jtb.pre_forum_thread.tid = jtb.pre_forum_threadimage.tid
WHERE displayorder >=0 LIMIT 0 , 2"}
<li><a href="/bbs/forum.php?mod=viewthread&tid=[field:tid /]"><img src="bbs/data/attachment/forum/[field:attachment/]" width="153px" height="100px" /></a></li>
<li><a href="/bbs/forum.php?mod=viewthread&tid=[field:tid /]">[field:subject function="cn_substr('@me',28)" /]</a></li>
{/dede:sql}
調(diào)用即圖中右邊的部分,網(wǎng)友最關(guān)注的問題是dz置頂貼,在dz表中的字段是由displayorder控制的,帖子中回復(fù)個數(shù)可以用[field:replies /]顯示,而瀏覽量則是[field:views /]
<div class="pt6_bbs fl">
<h2>網(wǎng)友最關(guān)注的問題</h2>
<ul>{dede:loop table="jtb.pre_forum_thread" if="displayorder>0" sort="tid" row="4"}
<li><a href="/bbs/forum.php?mod=viewthread&tid=[field:tid /]"> [field:subject function="cn_substr('@me',48)" /]</a> <p><b>[field:replies /]</b>個回答 <strong>[field:views /]</strong>人關(guān)注</p></li>
{/dede:loop}
</ul>
</div>
<div class="pt6_bbs fr">
<h2>患者新的交流</h2>
<ul>{dede:loop table="jtb.pre_forum_thread" sort="tid" row="4"}
<li><a href="/bbs/forum.php?mod=viewthread&tid=[field:tid /]"> [field:subject function="cn_substr('@me',48)" /]</a> <p><b>[field:replies /]</b>個回答 <strong>[field:views /]</strong>人關(guān)注</p></li>
{/dede:loop}
</ul>
</div>