5.5.0版的也可以用~~已经试过了~~再次感谢楼主!!!
演示地址
5.5.0版与1楼修改稍有不同:
为了方便大家,给大家一个首页热门贴+今日发贴排行+在线时间排行+精华贴修改后的参照样板。。
修改discuz.php改为修改index.php:
找到$threads = $posts = $todayposts = $fids = $announcepm = 0;
在下面添加:
/////////////////////////////////////////////////////////////首页热门贴
//在线等级排行榜
$listnum=10;//个数
$listlength=32;//长度
$timelv="";
$query = $db->query("SELECT m.uid,m.username,m.oltime,o.* FROM {$tablepre}members m, {$tablepre}onlinetime o WHERE m.uid=o.uid ORDER BY total DESC LIMIT 0, $listnum");
while($members=$db->fetch_array($query)){
$members[totals]=round($members[total]/60,2);
$members[onlinetime]=$members[totals];
$i=0;
while((5*$i*$i+15*$i)<=$members[totals])
{$i++;
//$C=5*$i*$i+10*$i;
$N=$i;
}
$more= $members[totals] ? 20-$members[totals] % 20 : 20;
$lv= $N;
$timelv.="<a href='viewpro.php?uid=$members[uid]'>$members[username]</a> <img src=\"images/lv/{$lv}.gif\" alt=\"在线等级:{$lv} 级\n在线时长:{$members[onlinetime]} 小时\n升级剩余时间: {$more} 小时\"><br />";
}
unset($members);
//在线等级排行榜
//今日发贴排行
$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,11");
while($result=$db->fetch_array($query)){
$poststar.="<a href=viewpro.php?uid=".$result[authorid].">".$result[author]."</a> (<font color=red>".$result[num]."</font>)<br>";
}
//今日发贴排行
$hack_subject_len=40; //每个标题最多显示得字数
$hack_subject_num=11; //需要显示记录数
$hack_newthreads_threadlist = array();
$thread = array();
//最新贴
$query = $db->query("SELECT dateline,tid,subject,author,views,replies,lastpost,lastposter FROM {$tablepre}threads WHERE fid NOT IN(31,32,120,136,66,155) ORDER BY dateline DESC LIMIT 0, $hack_subject_num");
while($thread = $db->fetch_array($query)) {
$thread['forumname'] = $thread['name'];
$thread['date']= gmdate("$dateformat $timeformat", $thread['dateline'] + $timeoffset * 3600);
$thread['lastreplytime']= gmdate("$dateformat $timeformat", $thread[lastpost] + ($timeoffset * 3600));
$thread[subject0]=$thread[subject];
$thread['subject'] = cutstr($thread['subject'], $hack_subject_len);
$hack_newthreads_threadlist[] = $thread;
}
//最新贴
$threadview = $threadreply = array();
//最新回复
$query = $db->query("SELECT dateline,tid,subject,author,views,replies,lastpost,lastposter FROM {$tablepre}threads WHERE fid NOT IN(31,32,120,136,66,155) AND replies > 0 ORDER BY lastpost DESC LIMIT 0, $hack_subject_num");
while($thread = $db->fetch_array($query)) {
$thread[subject0]=$thread[subject];
$thread['forumname'] = $thread['name'];
$thread['date']= gmdate("$dateformat $timeformat", $thread['dateline'] + $timeoffset * 3600);
$thread['lastreplytime']= gmdate("$dateformat $timeformat", $thread[lastpost] + ($timeoffset * 3600));
$thread[subject] = cutstr($thread[subject], $hack_subject_len);
$threadreply[] = $thread;
}
//最新回复
$hack_newthreads_threaddigest = array();
//精华贴
$query = $db->query("SELECT
dateline,tid,subject,author,views,replies,lastpost,lastposter,digest FROM
{$tablepre}threads WHERE digest>'0' AND fid NOT IN(0) ORDER BY dateline DESC
LIMIT 0, $hack_subject_num");
while($thread = $db->fetch_array($query)) {
$thread['forumname'] = $thread['name'];
$thread['date']= gmdate("$dateformat $timeformat", $thread['dateline'] +
$timeoffset * 3600);
$thread['lastreplytime']= gmdate("$dateformat $timeformat", $thread
[lastpost] + ($timeoffset * 3600));
$thread[subject0]=$thread[subject];
$thread['subject'] = cutstr($thread['subject'], $hack_subject_len);
$hack_newthreads_threaddigest[] = $thread;
}
//精华贴
///////////////////////////////////////////////////////////////////首页热门贴
希望能对大家有所帮助~~版权贵楼主所有~~ |