您现在的位置是:首页 > 教程 > dedecms教程dedecms教程

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

梦松2023-11-02 23:36:41dedecms教程已有人查阅

导读调用附件带图片的贴;这是我琢磨自己写的希望对大家有帮助

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

本文标签:

很赞哦! ()

留言与评论 (共有 条评论)
验证码:

本栏推荐

相关标签