Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

仿D4在各版显示今日新帖 (FOR 2.5 SP1)

[复制链接]
vaiovr 发表于 2005-6-20 03:06:19 | 显示全部楼层 |阅读模式
仿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
查找:
  1.                 foreach($categories as $group) {
  2.                         $group_forum = array();
  3.                         foreach($forums as $fid => $forum) {
  4.                                 if($forum['fup'] == $group['fid']) {
  5.                                         if(forum($forum)) {
  6.                                                 $group_forum[] = $forum;
  7.                                                 unset($forums[$fid]);
  8.                                         }
复制代码

在前面添加:
  1. //仿D4在各版显示今日新帖     
  2.     $todayadd = array();
  3.     $todaypostcheck =mktime(0,0,0);
  4.     $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");
  5.     while($temp = $db->fetch_array($query)) {
  6.         $todayadd[$temp['fid']] = $temp['count'];
  7.         if ($temp['fup']) {
  8.             $todayadd[$temp['fup']] += $temp['count'];
  9.         }
  10.     $todayadd[$forum['fid']] = $todayadd[$temp['fid']];
  11.     }   
  12.     //仿D4在各版显示今日新帖
复制代码

   
修改文件forumdisplay.php
查找:
  1. $multipage = multi($threadcount, $tpp, $page, "forumdisplay.php?fid=$fid$forumdisplayadd");
复制代码

前面添加:
  1. //仿D4在各版显示今日新帖     
  2.     $todayadd = array();
  3.     $todaypostcheck =mktime(0,0,0);
  4.     $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");
  5.     while($temp = $db->fetch_array($query)) {
  6.         $todayadd[$temp['fid']] = $temp['count'];
  7.         if ($temp['fup']) {
  8.             $todayadd[$temp['fup']] += $temp['count'];
  9.         }
  10.     $todayadd[$forum['fid']] = $todayadd[$temp['fid']];
  11.     }   
  12.     //仿D4在各版显示今日新帖
复制代码
      
然后打开templates.lang.php语言包
查找:
  1. 'forum_threads' => '主题',
复制代码

在下面添加:
  1. 'forum_todayposts' => '今日',
复制代码

修改模版index.htm

查找 :
  1. <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"

查找 :
  1. <td width="46%">{lang forum_name}</td>
  2. <td width="8%">{lang forum_threads}</td>
  3. <td width="8%">{lang forum_posts}</td>
  4. <td width="15%">{lang forum_lastpost}</td>
  5. <td width="18%">{lang forum_moderators}</td>
复制代码

更换为:
  1. <td width="51%">{lang forum_name}</td>
  2. <td width="5%">{lang forum_threads}</td>
  3. <td width="5%">{lang forum_posts}</td>
  4. <td width="5%">{lang forum_todayposts}</td>
  5. <td width="13%">{lang forum_lastpost}</td>
  6. <td width="16%">{lang forum_moderators}</td>
复制代码

再找:
  1. <td bgcolor="{ALTBG2}">$forum[posts]</td>
复制代码

在下面添加:
  1. <td bgcolor="{ALTBG2}"><!--{if $todayadd[$forum[fid]]}-->{eval echo $todayadd[$forum['fid']];}<!--{else}-->0<!--{/if}--></td>
复制代码

修改模版forumdisplay_subforum.htm
找到:
  1. <td width="46%" class="header" align="center">{lang forum_name}</td>
  2. <td width="8%" class="header" align="center">{lang forum_threads}</td>
  3. <td width="8%" class="header" align="center">{lang forum_posts}</td>
  4. <td width="15%" class="header" align="center">{lang forum_lastpost}</td>
  5. <td width="17%" class="header" align="center">{lang forum_moderators}</td>
复制代码

更换为:
  1. <td width="51%"class="header" align="center">{lang forum_name}</td>
  2. <td width="5%"class="header" align="center">{lang forum_threads}</td>
  3. <td width="5%"class="header" align="center">{lang forum_posts}</td>
  4. <td width="5%"class="header" align="center">{lang forum_todayposts}</td>
  5. <td width="13%"class="header" align="center">{lang forum_lastpost}</td>
  6. <td width="16%"class="header" align="center">{lang forum_moderators}</td>
复制代码

再找:
  1. <td bgcolor="{ALTBG2}">$forum[posts]</td>
复制代码

在下面添加:
  1. <td bgcolor="{ALTBG2}"><!--{if $todayadd[$forum[fid]]}-->{eval echo $todayadd[$forum['fid']];}<!--{else}-->0<!--{/if}--></td>
复制代码


然后更新缓存,记得!很重要的。
----完成-----

[ 本帖最后由 vaiovr 于 2005-6-22 02:50 编辑 ]
泡哥 发表于 2005-6-20 04:03:17 | 显示全部楼层
增加查询  支持 但不用!
回复

使用道具 举报

mmcatv 发表于 2005-6-20 04:22:42 | 显示全部楼层
支持一下!
回复

使用道具 举报

laoyang 发表于 2005-6-20 08:52:42 | 显示全部楼层
D4的怎么不增加查询呢?是不是用缓存的?
回复

使用道具 举报

freddy 发表于 2005-6-20 09:13:00 | 显示全部楼层
支持原创~加精了!
回复

使用道具 举报

xjbl 发表于 2005-6-20 09:51:24 | 显示全部楼层
原帖由 laoyang 于 2005-6-20 08:52 发表
D4的怎么不增加查询呢?是不是用缓存的?


是啊...
回复

使用道具 举报

青春E族 发表于 2005-6-21 09:50:41 | 显示全部楼层
出了一点问题,请帮忙看一下~
回复

使用道具 举报

 楼主| vaiovr 发表于 2005-6-21 10:48:38 | 显示全部楼层
原帖由 青春E族 于 2005-6-21 09:50 发表
出了一点问题,请帮忙看一下~


找到
  1. <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" 即可
回复

使用道具 举报

青春E族 发表于 2005-6-21 11:35:52 | 显示全部楼层
解决了,谢谢,很不错的一个hack
回复

使用道具 举报

skyline999 发表于 2005-6-21 13:50:44 | 显示全部楼层
謝謝 支持!~
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2024-4-30 21:50 , Processed in 0.137155 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表