dedecms5.7织梦系统首页sql调用disucuz2.5内容

注明:如果你安装在不同的数据库,需要在sql中指定数据库,我这边是jtb,与公司的织梦dedecms不是安装在同库中。 
调用图文帖子的方法: 
{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} 
dedecms5.7织梦系统首页sql调用disucuz2.5内容 
调用即图中右边的部分,网友最关注的问题是dz置顶贴,在dz表中的字段是由displayorder控制的,帖子中回复个数可以用[field:replies /]显示,而浏览量则是[field:views /] 
<div class="pt6_bbs fl"> 
<h2>网友最关注的问题</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>人关注</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>人关注</p></li> 
{/dede:loop} 
</ul> 
</div>