Manyou诚邀开发者加盟 | 常见问题
《站长》俱乐部官方群公布 城市联络员机会多多
立即免费下载 Discuz!7.0.0 正式版
安装升级指南 | 用户手册 | 新手建站学堂
基于.net架构的Discuz!NT2.6正式版发布
Comsenz公司2009年招贤纳士,期待您的加盟
Discuz!收费服务内容及价格
7月重庆、成都、西安三地社区运营实战特训速报名
Discuz!/UCHome 专用官方虚拟主机
牧场新服一起联运:豆浆机免费带回家
基于Discuz!的免费论坛空间5D6D
康盛创想《站长》俱乐部18城市互动之旅报名ing
返回列表 回复 发帖

许多人求这种在首页四格下加一行今日发贴排行的插件.

RT!演示:http://www.bbswap.com/bbs

安装方法:安装好首页四格后的朋友可以直接修改。无需上传附件.
简易程度:相当简单。
可按以下方法直接

第一步:修改index.php(修改前请先做好备份,以防万一)

查找
  1. $rsshead = $rssstatus
复制代码
在其上的代码前会有一段标识:
  1. / /----首页多格代码开始   //----首页多格代码结束
复制代码
在 //----首页多格代码结束 前加入
  1. //今日发贴排行
  2. $tomonth=date(n);
  3. $todate=date(j);
  4. $toyear=date(Y);
  5. $time=mktime(0,0,0,$tomonth,$todate,$toyear);
  6. $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");
  7. while($result=$db->fetch_array($query)){
  8.         $poststar.="<a href=space.php?uid=".$result[authorid].">".cutstr($result[author],10)."</a> <font color=red>[".$result[num]."]</font>  ";
  9. }
复制代码
我的四格是在index.php  里引用index_four.php文件。和我相同的朋友可以编辑index_four.php文件
  1.         writetocache("showother", '', $curdata);
复制代码
前加入:
  1. //今日发贴排行
  2. $tomonth=date(n);
  3. $todate=date(j);
  4. $toyear=date(Y);
  5. $time=mktime(0,0,0,$tomonth,$todate,$toyear);
  6. $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");
  7. while($result=$db->fetch_array($query)){
  8.         $poststar.="<a href=space.php?uid=".$result[authorid].">".cutstr($result[author],10)."</a> <font color=red>[".$result[num]."]</font>  ";
  9. }
复制代码
第二步:修改templates/你使用模板目录下/discuz.htm文件:

找到:
  1. </table>
  2. </div>
  3. <!-- 首页多格代码结束 -->
复制代码
在之前加入:
  1. <tr>
  2. <td colspan=4>今日发贴TOP10:$poststar</td>
  3. </tr>
复制代码
安装完成!
————————————————————————————————————————————————————————

如果希望在四格下加入三行发贴排行展示的朋友可把第一步加入代码换成
1.
  1. //今日发贴排行
  2. $tomonth=date(n);
  3. $todate=date(j);
  4. $toyear=date(Y);
  5. $time=mktime(0,0,0,$tomonth,$todate,$toyear);
  6. $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");
  7. while($result=$db->fetch_array($query)){
  8.         $poststar.="<a href=space.php?uid=".$result[authorid].">".cutstr($result[author],10)."</a> <font color=red>[".$result[num]."]</font>  ";
  9. }
  10. //本月发贴排行
  11. $tomonth=date(n);
  12. $toyear=date(Y);
  13. $time=mktime(0,0,0,$tomonth,0,$toyear);
  14. $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");
  15. while($result=$db->fetch_array($query)){
  16.         $monthpoststar.="<a href=space.php?uid=".$result[authorid].">".cutstr($result[author],10)."</a> <font color=red>[".$result[num]."]</font>  ";
  17. }
  18. //当年发贴排行
  19. $toyear=date(Y);
  20. $time=mktime(0,0,0,0,0,$toyear);
  21. $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");
  22. while($result=$db->fetch_array($query)){
  23.         $yearpoststar.="<a href=space.php?uid=".$result[authorid].">".cutstr($result[author],6)."</a> <font color=red>[".$result[num]."]</font>  ";
  24. }
复制代码
同时把第二步加入代码换成
  1. <tr>
  2. <td colspan=4>今日发贴TOP10:$poststar</td>
  3. </tr>
  4. <tr>
  5. <td colspan=4>本月发贴TOP10:$monthpoststar</td>
  6. </tr>
  7. <tr>
  8. <td colspan=4>当年发贴TOP10:$yearpoststar</td>
  9. </tr>
复制代码
更新缓存!


——————————————————————————————————————
有问题可以PM我。或Q我80155
贴内我给出的是针对不同情况的2种方法,请做修改的时候仔细按步骤来。

[ 本帖最后由 keigo583 于 2007-12-13 05:54 编辑 ]
未命名.jpg
自己坐个沙发
板凳我来做

谢谢LZ分享
  网管员之家   签名位招租 50元/月(现付)
不错哦.我正想要叱.
恋爱达人
http://www.62dr.com

回复 1# 的帖子

顶个支持!
不错哦,等会我也来试试
晕死,我的INDEX.PHP里怎么没有“$rsshead = $rssstatus。”
不错,顶一个。
按照楼主的方法安装后出现重复的POP榜单,是怎么回事呢,请高手指教!
我的论坛:www.cqsubaru.com
图片如下
发贴之星截图.jpg
2007-11-19 22:50
返回列表