|
以前做图片论坛的时候有这个需求,就是在列表页显示图片数量,如[1p][2p]...酱紫,但当时没找到方法就放弃了,刚才瞎逛看到此法,特此留存。
1、修改模型处理文件
../source/module/forum/forum_forumdisplay.php
查找:$threadids[$threadindex] = $thread['tid'];
在这段代码后面添加如下代码
- $thread['$pic_s'] = C::t('forum_attachment')->count_by_tid($thread['tid']);
复制代码
2、修改模板文件
../template/当前模版目录(默认是default)/forum/forumdisplay_list.htm
查找:<!--{if $thread['attachment'] == 2}-->
找到:<!--{if $thread['attachment'] == 2}-->
在其后面加上刚刚在模型内添加的变量:$thread['$pic_s']并且给他一些修饰
- <span style="color:#f40"]>[{$thread['$pic_s']}P]</span>
复制代码
3、登录网站后台更新缓存
4、搞定,效果图:
-
-
090721lfjyfsfdrrccddf6.png免费
30.15 KB, 下载次数: 84
下载
记录
|
|