準(zhǔn)確的說應(yīng)該是調(diào)用多圖,如果是一張圖,直接設(shè)置封面即可,就不需要費這勁了。
網(wǎng)上也有方法,不過我不喜歡他們的方式。
代碼可以直接寫在模板forumdisplay_list.htm里,有不同數(shù)量不同樣式。

以默認(rèn)模板為例:
打開模板forum/forumdisplay_list.htm,找到83行左右:
<!--{loop $_G['forum_threadlist'] $key $thread}-->
在其下增加
<!--{eval $tbid = DB::result(DB::query("SELECT tableid FROM ".DB::table('forum_attachment')." WHERE `tid`= '$thread[tid]'"));}-->
<!--{if $tbid}-->
<!--{eval $picount = DB::fetch_all("SELECT aid FROM ".DB::table('forum_attachment_'.$tbid.'')." WHERE `tid`= '$thread[tid]' AND `isimage`=1;");}-->
<!--{eval $picnum = count($picount);}-->
<!--{if $picnum < 3}-->
<!--{eval $litpicnum = '1';}-->
<!--{elseif $picnum > 2 && $picnum < 6}-->
<!--{eval $litpicnum = '3';}-->
<!--{elseif $picnum > 5}-->
<!--{eval $litpicnum = '6';}-->
<!--{/if}-->
<!--{eval $covers = DB::fetch_all("SELECT attachment,aid,description FROM ".DB::table('forum_attachment_'.$tbid.'')." WHERE `tid`= '$thread[tid]' AND `isimage`=1 LIMIT 0,$litpicnum;");}-->
<!--{/if}-->
再查找
<!-- end of table "forum_G[fid]" branch 1/3 -->
其上最近的</tr>之后增加
<!--{if $tbid}-->
<tr>
<td></td>
<td></td>
<td colspan="4">
<!--{loop $covers $thecover}-->
<!--{if $litpicnum == 1}-->
<a href="forum.php?mod=viewthread&tid=$thread[tid]" class="z pipe" title="$thecover[aid]"><img src="data/attachment/forum/$thecover['attachment']" width="100" height="100"/></a>
<font class="z">This is what it is like to be with Trump.</font>
<!--{else}-->
<a href="forum.php?mod=viewthread&tid=$thread[tid]" class="z pipe" title="$thecover[aid]"><img src="data/attachment/forum/$thecover['attachment']" width="100" height="100"/></a>
<!--{/if}-->
<!--{/loop}-->
</td>
</tr>
<!--{/if}-->
再找到
<!--{if !$thread['forumstick'] && ($thread['isgroup'] == 1 || $thread['fid'] != $_G['fid'])}-->
<!--{if $thread['related_group'] == 0 && $thread['closed'] > 1}-->
<!--{eval $thread[tid]=$thread[closed];}-->
<!--{/if}-->
<!--{if $groupnames[$thread[tid]]}-->
<span class="fromg xg1"> [{lang from}: <a href="forum.php?mod=group&fid={$groupnames[$thread[tid]][fid]}" target="_blank" class="xg1">{$groupnames[$thread[tid]][name]}</a>]</span>
<!--{/if}-->
<!--{/if}-->
其下增加
<!--{if $tbid && !$picnum == 0}--><span style="color:red;"><!--{$picnum}-->P</span><!--{/if}--></a>
結(jié)束。
具體的圖片顯示多少這里↓,<3顯示1,>2且<6顯示3,>5顯示6。
<!--{if $picnum < 3}-->
<!--{eval $litpicnum = '1';}-->
<!--{elseif $picnum > 2 && $picnum < 6}-->
<!--{eval $litpicnum = '3';}-->
<!--{elseif $picnum > 5}-->
<!--{eval $litpicnum = '6';}-->
<!--{/if}-->
這個是匆忙寫的,沒注意有沒有邏輯漏洞,如有錯請?zhí)岢觥?/p>
后面具體的樣式是這段↓
<!--{if $litpicnum == 1}-->
<a href="forum.php?mod=viewthread&tid=$thread[tid]" class="z pipe" title="$thecover[aid]"><img src="data/attachment/forum/$thecover['attachment']" width="100" height="100"/></a>
<font class="z">This is what it is like to be with Trump.</font>
<!--{else}-->
<a href="forum.php?mod=viewthread&tid=$thread[tid]" class="z pipe" title="$thecover[aid]"><img src="data/attachment/forum/$thecover['attachment']" width="100" height="100"/></a>
<!--{/if}-->
如果圖片數(shù)量等于1,后面帶個摘要,否則圖片橫排鋪開。具體數(shù)量會按上面的顯示。
通常情況下,兩種樣式即可,1圖和多圖,即1圖顯示在左右,多圖在下面鋪開,如果多種樣式,<!–{if $litpicnum == 數(shù)量}–>此數(shù)量時的表現(xiàn)形式</if>。
當(dāng)然,這的數(shù)量$litpicnum是受上面的代碼中與$picnum關(guān)系的限定,$picnum是實際總數(shù)量,$litpicnum是經(jīng)過判斷后允許顯示的數(shù)量。






