插件作者的标准出来了!Manyou诚邀开发者加盟!
“互联网平台开发者”特刊 有奖征集开发者
立即免费下载 Discuz!6.1.0正式版
Discuz! 6.1.0 使用说明
Discuz!NT2.5正式版发布
开放源码下载
UCenter Home 1.2 正式版发布
官方站 | 帮助文档
基于ECShop的网店托管-卖否
PHP就业培训直通车 | LAMP培训大连
Discuz!收费服务内容及价格
“感谢有你同行”手握手2008年数万元重奖志愿者
Discuz!/ECShop 专用官方虚拟主机
【九城-奇迹世界】专题活动开始了!
Comsenz 招聘信息
网店系统ECShop v2.6.0正式版火热发布
基于Discuz!的免费论坛空间5D6D
参与有奖社区调查 赢取台湾5日游
 29 123
发新话题
打印

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

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

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

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

第一步:修改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>  ";
}
我的四格是在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 编辑 ]

附件

未命名.jpg (91.31 KB)

2007-11-16 16:49

未命名.jpg

自己坐个沙发
板凳我来做

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

回复 1# 的帖子

顶个支持!
不错哦,等会我也来试试
晕死,我的INDEX.PHP里怎么没有“$rsshead = $rssstatus。”
不错,顶一个。
按照楼主的方法安装后出现重复的POP榜单,是怎么回事呢,请高手指教!
我的论坛:www.cqsubaru.com
图片如下
 29 123
发新话题
版块跳转