第一步:修改index.php(修改前请先做好备份,以防万一)
查找
复制内容到剪贴板
代码:
$rsshead = $rssstatus在其上的代码前会有一段标识:
复制内容到剪贴板
代码:
/ /----首页多格代码开始 //----首页多格代码结束在 //----首页多格代码结束 前加入
复制内容到剪贴板
代码:
//今日发贴排行
$tomonth=date(n);
$todate=date(j);
$toyear=date(Y);
$time=mktime(0,0,0,$tomonth,$todate,$toyear);
$query=$db->query("select count(pid) as num,authorid,author from $tablepre"."posts where dateline>=$time group by authorid order by num desc limit 0,10");
while($result=$db->fetch_array($query)){
$poststar.="<a href=space.php?uid=".$result[authorid].">".cutstr($result[author],10)."</a> <font color=red>[".$result[num]."]</font> ";
}第二步:修改templates/你使用模板目录下/discuz.htm文件:
找到
复制内容到剪贴板
代码:
</table>
</div>
<!-- 首页多格代码结束 -->在之前加入:
复制内容到剪贴板
代码:
<tr>
<td colspan=4>今日发贴TOP10:$poststar</td>
</tr>安装完成!
———————————————————————————————————————————
如果希望在四格下加入三行发贴排行展示的朋友可把第一步加入代码换成
1.
复制内容到剪贴板
代码:
//今日发贴排行
$tomonth=date(n);
$todate=date(j);
$toyear=date(Y);
$time=mktime(0,0,0,$tomonth,$todate,$toyear);
$query=$db->query("select count(pid) as num,authorid,author from $tablepre"."posts where dateline>=$time group by authorid order by num desc limit 0,10");
while($result=$db->fetch_array($query)){
$poststar.="<a href=space.php?uid=".$result[authorid].">".cutstr($result[author],10)."</a> <font color=red>[".$result[num]."]</font> ";
}
//本月发贴排行
$tomonth=date(n);
$toyear=date(Y);
$time=mktime(0,0,0,$tomonth,0,$toyear);
$query=$db->query("select count(pid) as num,authorid,author from $tablepre"."posts where dateline>=$time group by authorid order by num desc limit 0,10");
while($result=$db->fetch_array($query)){
$monthpoststar.="<a href=space.php?uid=".$result[authorid].">".cutstr($result[author],10)."</a> <font color=red>[".$result[num]."]</font> ";
}
//当年发贴排行
$toyear=date(Y);
$time=mktime(0,0,0,0,0,$toyear);
$query=$db->query("select count(pid) as num,authorid,author from $tablepre"."posts where dateline>=$time group by authorid order by num desc limit 0,10");
while($result=$db->fetch_array($query)){
$yearpoststar.="<a href=space.php?uid=".$result[authorid].">".cutstr($result[author],6)."</a> <font color=red>[".$result[num]."]</font> ";
}同时把第二步加入代码换成
复制内容到剪贴板
代码:
<tr>
<td colspan=4>今日发贴TOP10:$poststar</td>
</tr>
<tr>
<td colspan=4>本月发贴TOP10:$monthpoststar</td>
</tr>
<tr>
<td colspan=4>当年发贴TOP10:$yearpoststar</td>
</tr>更新缓存!
参考
http://www.discuz.net/thread-788105-1-1.html