97久久国产亚洲精品超碰热,成人又色又爽的免费网站,色偷偷女人的天堂a,男女高潮喷水在线观看,国内精品一线二线三线区别在哪里

Discuz! 官方交流社區(qū)

標(biāo)題: 求助,如何在主題列表頁面-每個主題列表下添加4張附件圖片。 [打印本頁]

作者: 1544765    時間: 2024-3-19 16:33
標(biāo)題: 求助,如何在主題列表頁面-每個主題列表下添加4張附件圖片。
不使用插件的情況下,修改forumdisplay.php文件實現(xiàn)每個主題列表下顯示4張附件圖片,圖片顯示順序按帖子內(nèi)圖片附件順序排序。


以官方列表為例:這樣的顯示過于單調(diào)。
(, 下載次數(shù): 13)


最終我需要顯示的效果如下:
(, 下載次數(shù): 14)


請問有大神知道應(yīng)該怎么修改嗎?實在是找不到相應(yīng)的教程才提問的。

作者: 科站網(wǎng)    時間: 2024-3-19 16:55
https://addon.dismall.com/plugin ... on=9252YMBQIXFBIMJW
作者: 1544765    時間: 2024-3-19 16:57
發(fā)現(xiàn)不是forumdisplay.php文件  是 forumdisplay_list_box.php文件
作者: 1544765    時間: 2024-3-19 17:32
科站網(wǎng) 發(fā)表于 2024-3-19 16:55
https://addon.dismall.com/plugins/qu_forumimglist.html?union=9252YMBQIXFBIMJW

謝謝 但是我不想使用插件
作者: onetheme    時間: 2024-3-19 18:01
插件不好嗎? 沒基礎(chǔ)搞不了,可以有償實現(xiàn)!需要的話聯(lián)系QQ
作者: luolongwei    時間: 2024-3-20 22:35
discuz x3.4/x3.3帖子列表頁調(diào)用帖子內(nèi)容圖片附件(多圖)

1、找到forum/forumdisplay_list.htm文件,打開并按照以下方法進行編輯;
2、打開forumdisplay_list.htm文件后,找到
  1. <!--{loop $_G['forum_threadlist'] $key $thread}-->
復(fù)制代碼
代碼,在其下添加:
  1. <!--{eval $tbid = DB::result(DB::query("SELECT tableid FROM ".DB::table('forum_attachment')." WHERE `tid`= '$thread[tid]'"));}-->
  2. <!--{if $tbid}-->
  3. <!--{eval $picount = DB::fetch_all("SELECT aid FROM ".DB::table('forum_attachment_'.$tbid.'')." WHERE `tid`= '$thread[tid]' AND `isimage`=1;");}-->
  4. <!--{eval $picnum = count($picount);}-->
  5. <!--{if $picnum < 3}-->
  6. <!--{eval $litpicnum = '1';}-->
  7. <!--{elseif $picnum > 2 && $picnum < 6}-->
  8. <!--{eval $litpicnum = '3';}-->
  9. <!--{elseif $picnum > 5}-->
  10. <!--{eval $litpicnum = '6';}-->
  11. <!--{/if}-->
  12. <!--{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;");}-->
  13. <!--{/if}-->
復(fù)制代碼
3、在forumdisplay_list.htm中繼續(xù)找到
  1. <!-- end of table "forum_G[fid]" branch 1/3 -->
復(fù)制代碼
在這段代碼上方找到最靠近的</tr>,在此之后添加:
  1. <!--{if $tbid}-->
  2. <tr>
  3. <td></td>
  4. <td></td>
  5. <td colspan="4">
  6. <!--{loop $covers $thecover}-->
  7. <!--{if $litpicnum == 1}-->
  8. <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>
  9. <font class="z">This is what it is like to be with Trump.</font>
  10. <!--{else}-->
  11. <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>
  12. <!--{/if}-->
  13. <!--{/loop}-->
  14. </td>
  15. </tr>
  16. <!--{/if}-->
復(fù)制代碼
4、繼續(xù)找到:
  1. <!--{if !$thread['forumstick'] && ($thread['isgroup'] == 1 || $thread['fid'] != $_G['fid'])}-->
  2. <!--{if $thread['related_group'] == 0 && $thread['closed'] > 1}-->
  3. <!--{eval $thread[tid]=$thread[closed];}-->
  4. <!--{/if}-->
  5. <!--{if $groupnames[$thread[tid]]}-->
  6. <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>
  7. <!--{/if}-->
  8. <!--{/if}-->
復(fù)制代碼
在之后添加
  1. <!--{if $tbid && !$picnum == 0}--><span style="color:red;"><!--{$picnum}-->P</span><!--{/if}--></a>
復(fù)制代碼
保存后完成!效果如下圖所示。
(, 下載次數(shù): 15)


【代碼分析】:
1、上面介紹的代碼中,有一段是設(shè)置圖片顯示數(shù)量的邏輯代碼,如下
  1. <!--{if $picnum < 3}-->
  2. <!--{eval $litpicnum = '1';}-->
  3. <!--{elseif $picnum > 2 && $picnum < 6}-->
  4. <!--{eval $litpicnum = '3';}-->
  5. <!--{elseif $picnum > 5}-->
  6. <!--{eval $litpicnum = '6';}-->
復(fù)制代碼
意思是當(dāng)內(nèi)容中圖片數(shù)量小于3時,顯示1張圖片;
當(dāng)圖片數(shù)量大于2小于6時,圖片顯示3張;
當(dāng)圖片數(shù)量大于5時,顯示6張圖片。大家可以按照需求進行修改。
2、代碼中設(shè)置的圖片長和寬都是100px,width="100" height="100"如果有需要可以按照自己的想法修改數(shù)值。





作者: babyfacer    時間: 2024-3-20 23:32
luolongwei 發(fā)表于 2024-3-20 22:35
discuz x3.4/x3.3帖子列表頁調(diào)用帖子內(nèi)容圖片附件(多圖)

1、找到forum/forumdisplay_list.htm文件,打開 ...

666,這個不錯




歡迎光臨 Discuz! 官方交流社區(qū) (http://r615.cn/) Powered by Discuz! X5.0