POST TIME:2020-03-28 23:49
最近幫朋友整合了DEDECSM V5.6和discuz x1.5后,朋友又再次找到我,咨詢如何實現在織夢CMS的相關欄目中調用論壇的相關數據。于是我嘗試調用“活躍會員”“指定帖子”“帖子中的圖片”這三個內容,經過一天的努力,終于實現,現在發出來,提供給大家研究學習。
一、調用活躍會員:
{dede:loop table="pre_common_member" sort="credits" row="5" infolen='4'}
<tr>
<td><div style="margin-top:5px;"><A href="/bbs/home.php?mod=space&uid=[field:uid /]" target="_blank"><IMG src="/bbs/uc_server/avatar.php?uid=[field:uid /]&size=middle" width="35" height="26"></A><A href="/bbs/home.php?mod=space&uid=[field:uid /]" target="_blank" style="font-size:12px; color:#626262; margin-left:5px;">[field:username/]</A></div></td>
</tr>{/dede:loop}
二、調用指定板塊帖子
{dede:loop table="pre_forum_thread" if="fid=42"sort="tid" row="4"}
<li class="li3 font-size text2">
<A href="/bbs/forum.php?mod=viewthread&tid=[field:tid /]&extra=page%3D1" target="_blank" style="color:#626262">·[field:subject function="cn_substr('@me',30)" /]</A> </li> {/dede:loop}
三、調用帖子中的圖片
{dede:sql sql="SELECT`pre_forum_attachment`.`aid`, `pre_forum_attachment`.`attachment`,`pre_forum_thread`.`tid`, `pre_forum_thread`.`fid`, `pre_forum_thread`.`subject` FROM `pre_forum_attachment` LEFT JOIN `pre_forum_thread` ON `pre_forum_thread`.`tid`=`pre_forum_attachment`.`tid` WHERE `pre_forum_attachment`.`readperm`='0' AND `displayorder`>='0' AND `filetype`='application/octet-stream' GROUP BY tid LIMIT 1,5 "}
<div class="floatl margint content-bottom1">
<div class="floatl">
<a href="/bbs/forum.php?mod=viewthread&tid=[field:tid /]">
<img src="/bbs/data/attachment/forum/[field:attachment/]"ALT="[field:subject/]" width="100" height="80" border="0" /> </a>
</div>
<div class="floatl margint font-size"style="*margin-top:0;">
<a href="/bbs/forum.php?mod=viewthread&tid=[field:tid /]">[field:subject function="cn_substr('@me',18)"/]</a>
</div>
</div> {/dede:sql}
上一篇:修改織夢CMS官方網址長度的方法
下一篇:檢測密碼強度的代碼