dedecms模板调用论坛DZ的带附件为图片的帖子

这是一个初秋的夜晚,天气晴朗,一丝风都没有,抬头仰望,湛蓝的天空中,挂着一轮金黄的圆月。月亮把它那淡淡的月光毫不吝啬地撒向洞庭湖。圆月四周,稀稀疏疏地点缀着几颗星星,那几颗星星也把微弱的光源聚集起来,撒向月光下的湖面。这下,洞庭湖真是美极了。

 

调用附件带图片的贴子
——————————————————————————————-
{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,2"}
  <li><A rel="nofollow noopener noreferrer" href="/bbs/viewthread.php?tid=[field:tid /]"><IMG src="/bbs/attachments/[field:attachment/]"></A></li>
  <li><A rel="nofollow noopener noreferrer" href="/bbs/viewthread.php?tid=[field:tid /]">[field:subject function="cn_substr('@me',30)" /]</A></li>
{/dede:sql}

这是我琢磨自己写的   希望对大家 有帮助  

 

{dede:sql sql="select dz_threads.tid,dz_attachments.attachment,dz_threads.subject from dz_threads,dz_attachments where dz_threads.tid= (select distinct  dz_threads.tid from dz_threads,dz_attachments where dz_attachments.isimage=1 and dz_attachments.tid=dz_threads.tid and dz_threads.fid=4 order by dz_threads.tid desc limit 0,1) and dz_attachments.tid=dz_threads.tid order by dz_threads.tid desc limit 0,1"}
  <li><A rel="nofollow noopener noreferrer" href="/bbs/viewthread.php?tid=[field:tid /]"><IMG src="/bbs/attachments/[field:attachment/]"></A></li>
  <li><A rel="nofollow noopener noreferrer" href="/bbs/viewthread.php?tid=[field:tid /]">[field:subject function="cn_substr('@me',30)" /]</A></li>
{/dede:sql}

本文dedecms模板调用论坛DZ的带附件为图片的帖子到此结束。少壮真当努力,一年过去,何可攀援。小编再次感谢大家对我们的支持!

标签: dedecms DZ