Discuz相关标贴帖子封面图调用方法
程序目录source\module\forum\forum_viewthread.php 搜索$post['relateitem']
改为
if($post['tags']) {
$post['relateitem'] = getrelateitem($post['tags'], $post['tid'], $_G['setting']['relatenum'], $_G['setting']['relatetime']);
foreach($post['relateitem'] as $k=>$img)
{
$threada= C::t('forum_attachment')->fetch_all_by_id('tid', $img['tid'], 'aid');
$threadaid = reset($threada);
$threadpic = C::t('forum_attachment_n')->fetch_by_aid_uid($threadaid['tableid'], $threadaid['aid'], $thread['authorid']);
$thread['pic'] = $threadpic['attachment'];
$post['relateitem'][$k]['img'] = 'data/attachment/forum/'.$thread['pic'];
}
}模板目录\template\default\forum\viewthread_node.htm
<!--{if $post['relateitem']}-->
<div class="mtw mbw">
<h3 class="pbm mbm bbda">{lang related_thread}</h3>
<ul class="xl xl2 cl">
<!--{loop $post['relateitem'] $var}-->
<li>• <a href="forum.php?mod=viewthread&tid=$var[tid]" title="$var[subject]" target="_blank">
<img src="$var[img]" height="252" width="175" alt="$var[subject]" >$var[subject]</a>
</li>
<!--{/loop}-->
</ul>
</div>
<!--{/if}-->调用标签 $var[img]
本文由:xiaoshu168 作者:xiaoshu发表,转载请注明来源!