|

- 帖子
- 52
- 积分
- 42
- 威望
- 0
- 金币
- 0 个
- 体力
- 63
- 注册时间
- 2005-12-1
|

许多人求这种在首页四格下加一行今日发贴排行的插件.
RT!演示:http://www.bbswap.com/bbs
安装方法:安装好首页四格后的朋友可以直接修改。无需上传附件.
简易程度:相当简单。
可按以下方法直接
第一步:修改index.php(修改前请先做好备份,以防万一)
查找在其上的代码前会有一段标识:- / /----首页多格代码开始 //----首页多格代码结束
复制代码 在 //----首页多格代码结束 前加入- //今日发贴排行
- $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> ";
- }
复制代码 我的四格是在index.php 里引用index_four.php文件。和我相同的朋友可以编辑index_four.php文件
在- writetocache("showother", '', $curdata);
复制代码 前加入:- //今日发贴排行
- $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>
复制代码 更新缓存!
——————————————————————————————————————
有问题可以PM我。或Q我80155
贴内我给出的是针对不同情况的2种方法,请做修改的时候仔细按步骤来。
[ 本帖最后由 keigo583 于 2007-12-13 05:54 编辑 ] |
|