仿D4在各版显示今日新帖 (FOR 2.5 SP1)
=======================================
适用版本:DISCUZ 2.5 SP1
原插件作者:Nas
整理插件 :vaiovr
修改文件:index.php/forumdisplay.php
修改模版:index.htm/forumdisplay_subforum.htm
安装难易:容易
演 示:http://discuz.vaiovr.biz(看就好了不要来,因为我的论坛是测试用的)
提示:本插件为添加式安装,反安装时只需将所添加内容删除即可。另外,為了安全,请备份自己的文件
修改文件index.php
查找:
- foreach($categories as $group) {
- $group_forum = array();
- foreach($forums as $fid => $forum) {
- if($forum['fup'] == $group['fid']) {
- if(forum($forum)) {
- $group_forum[] = $forum;
- unset($forums[$fid]);
- }
复制代码
在前面添加:
- //仿D4在各版显示今日新帖
- $todayadd = array();
- $todaypostcheck =mktime(0,0,0);
- $query = $db->query("SELECT p.fid, count(p.pid) as count ,f.fup FROM $table_posts p left join $table_forums f on f.fid=p.fid WHERE p.dateline >='$todaypostcheck' GROUP BY p.fid");
- while($temp = $db->fetch_array($query)) {
- $todayadd[$temp['fid']] = $temp['count'];
- if ($temp['fup']) {
- $todayadd[$temp['fup']] += $temp['count'];
- }
- $todayadd[$forum['fid']] = $todayadd[$temp['fid']];
- }
- //仿D4在各版显示今日新帖
复制代码
修改文件forumdisplay.php
查找:
- $multipage = multi($threadcount, $tpp, $page, "forumdisplay.php?fid=$fid$forumdisplayadd");
复制代码
前面添加:
- //仿D4在各版显示今日新帖
- $todayadd = array();
- $todaypostcheck =mktime(0,0,0);
- $query = $db->query("SELECT p.fid, count(p.pid) as count ,f.fup FROM $table_posts p left join $table_forums f on f.fid=p.fid WHERE p.dateline >='$todaypostcheck' GROUP BY p.fid");
- while($temp = $db->fetch_array($query)) {
- $todayadd[$temp['fid']] = $temp['count'];
- if ($temp['fup']) {
- $todayadd[$temp['fup']] += $temp['count'];
- }
- $todayadd[$forum['fid']] = $todayadd[$temp['fid']];
- }
- //仿D4在各版显示今日新帖
复制代码
然后打开templates.lang.php语言包
查找:
在下面添加:
- 'forum_todayposts' => '今日',
复制代码
修改模版index.htm
查找 :
- <tr align="center"><td colspan="6" class="header"><a href="index.php?gid=$forum[fid]"><font color="{HEADERTEXT}"><span class="bold">$forum[name]</span></font></a></td></tr>
复制代码
将 colspan="6" 改为 colspan="7"
查找 :
- <td width="46%">{lang forum_name}</td>
- <td width="8%">{lang forum_threads}</td>
- <td width="8%">{lang forum_posts}</td>
- <td width="15%">{lang forum_lastpost}</td>
- <td width="18%">{lang forum_moderators}</td>
复制代码
更换为:
- <td width="51%">{lang forum_name}</td>
- <td width="5%">{lang forum_threads}</td>
- <td width="5%">{lang forum_posts}</td>
- <td width="5%">{lang forum_todayposts}</td>
- <td width="13%">{lang forum_lastpost}</td>
- <td width="16%">{lang forum_moderators}</td>
复制代码
再找:
- <td bgcolor="{ALTBG2}">$forum[posts]</td>
复制代码
在下面添加:
- <td bgcolor="{ALTBG2}"><!--{if $todayadd[$forum[fid]]}-->{eval echo $todayadd[$forum['fid']];}<!--{else}-->0<!--{/if}--></td>
复制代码
修改模版forumdisplay_subforum.htm
找到:
- <td width="46%" class="header" align="center">{lang forum_name}</td>
- <td width="8%" class="header" align="center">{lang forum_threads}</td>
- <td width="8%" class="header" align="center">{lang forum_posts}</td>
- <td width="15%" class="header" align="center">{lang forum_lastpost}</td>
- <td width="17%" class="header" align="center">{lang forum_moderators}</td>
复制代码
更换为:
- <td width="51%"class="header" align="center">{lang forum_name}</td>
- <td width="5%"class="header" align="center">{lang forum_threads}</td>
- <td width="5%"class="header" align="center">{lang forum_posts}</td>
- <td width="5%"class="header" align="center">{lang forum_todayposts}</td>
- <td width="13%"class="header" align="center">{lang forum_lastpost}</td>
- <td width="16%"class="header" align="center">{lang forum_moderators}</td>
复制代码
再找:
- <td bgcolor="{ALTBG2}">$forum[posts]</td>
复制代码
在下面添加:
- <td bgcolor="{ALTBG2}"><!--{if $todayadd[$forum[fid]]}-->{eval echo $todayadd[$forum['fid']];}<!--{else}-->0<!--{/if}--></td>
复制代码
然后更新缓存,记得!很重要的。
----完成-----
[ 本帖最后由 vaiovr 于 2005-6-22 02:50 编辑 ] |