【实测】Discuz相关帖子封面图调用-Discuz教程下载

【实测】Discuz相关帖子封面图调用

开通本站Svip会员,全站资源免费下
程序目录source\module\forum\forum_viewthread.php
搜索$post['relateitem']改为
  1. if($post['TAGs']) {
  2.    $post['relateitem'] = getrelateitem($post['tags'], $post['tid'], $_G['setting']['relatenum'], $_G['setting']['relatetime']);
  3.    foreach($post['relateitem'] as $k=>$img)
  4.    {
  5.         $threada= C::t('forum_attachment')->fetch_all_by_id('tid', $img['tid'], 'aid');
  6.         $threadaid = reset($threada);
  7.         $threadpic = C::t('forum_attachment_n')->fetch_by_aid_uid($threadaid['tableid'], $threadaid['aid'], $thread['authorid']);
  8.         $thread['pic'] = $threadpic['attachment'];  
  9.         $post['relateitem'][$k]['img'] = 'data/attachment/forum/'.$thread['pic'];
  10.    }
  11. }
复制代码
模板目录\template\default 或 当前使用模板\forum\viewthread_node.htm
  1. <!--{if $post['relateitem']}-->
  2.         <div class="mtw mbw">
  3.                 <h3 class="pbm mbm bbda">{lang related_thread}</h3>
  4.                 <ul class="xl xl2 cl">
  5.                         <!--{loop $post['relateitem'] $var}-->
  6.                         <li>&#8226; <a href="forum.php?mod=viewthread&tid=$var[tid]" title="$var[subject]" target="_blank">
  7.                         <img src="$var[img]" height="252" width="175" alt="$var[subject]" >$var[subject]</a>
  8.                         </li>
  9.                         <!--{/loop}-->
  10.                 </ul>
  11.         </div>
  12. <!--{/if}-->
复制代码
调用标签 $var[img]

全部评论 0

您需要登录后才可以回帖 立即登录
登录
0
0
0
返回顶部