关于dede 5.7 调用discuz x2.5 贴子图片的问题
dede 5.7 调用discuz x2.5 贴子图片的问题
HTML code
<!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
-->{dede:loop table="pre_forum_thread" fid="2″sort="tid" row="10"}
<a href="/bbs/forum.php?mod=viewthread&tid=%5Bfield:tid%20/%5D"><img src="/bbs/attachments/%5Bfield:attachments/%5D" alt="[field:subject/]" style="max-width:90%" style="max-width:90%" border="0"></a>{/dede:loop}
登录后复制
这段成功代码调用了 指定版块ID2 的贴子,但贴子的封面图片没被调用成功,图片的alt调用成了(alt="[field:subject/]") 。
------解决方案--------------------
得进行关联查询 pre_forum_thread表中是没有图片路径的
{dede:sql sql="SELECT`cdb_attachments`.`aid`,`cdb_attachments`.`attachment`,`cdb_threads`.`tid`, `cdb_threads`.`fid`,`cdb_threads`.`subject` FROM `cdb_attachments` LEFT JOIN `cdb_threads`
ON`cdb_threads`.`tid`=`cdb_attachments`.`tid` WHERE `cdb_attachments`.`readperm`='0' AND`displayorder`>='0' AND `filetype`='image/pjpeg' GROUP BY tid LIMIT 0,1 "}
{/dede:sql} 你参考下