首页幻灯图+主题排行+会员排行 for pw5.3(7.13更新)
7.13更新:修正帖子时间显示错误的bug特色:只需修改风格模板的 index.htm 文件即可,不用修改其他文件
一、打开你的风格模板的index.htm文件(默认:论坛根目录\template\wind\index.htm,如果不是默认风格的,位置在:论坛根目录\template\你的风格目录\index.htm)
在第一行找到:
<!--<?php print <<<EOT
-->
替换为下面的代码
<!--<?php
//首页调用开始
//默认只显示开放板块,不显示正规、隐藏、投票、认证板块
//幻灯图开始
$cachepics=R_P."data/bbscache/index_toppics.php";//幻灯图片缓存文件
$cachepicstime=60;//幻灯图片缓存自动更新时间,单位秒
//下一句设置要显示的板块类型,forum开放板块,former正规板块,hidden隐藏板块
$showforum="(pf.f_type = 'forum' or pf.f_type = 'former')";
if (($timestamp-@filemtime($cachepics)>=$cachepicstime)){
$query=$db->query("SELECT pt.tid,pt.fid,pt.subject,pa.attachurl FROM pw_threads pt
,pw_attachs pa,pw_forums pf where pt.tid = pa.tid and pt.fid = pf.fid and pa.type='img' and pt.ifcheck='1' and ".$showforum." and pf.password = ''
ORDER BY pt.postdate DESC
LIMIT 60
"); //可以根据需要调整,我这里是估算每个主题有10张图片的情况下。
$imgcontent="<?php\n";
$pics=$links=$texts="";
$rs_i=0;
while ($imginfo = $db->fetch_array($query) and $rs_i<6) {//只调用6个主题的图片
if(($rs_tid!=$imginfo)&&(eregi("\.(jpg)$",$imginfo))){
$pics.=$db_bbsurl."/".$attachpath."/".$imginfo."|";
$links.=$db_bbsurl."/read.php?tid=".$imginfo."|";
$texts.=$imginfo."|";
$rs_i++;//同一主题的只要最后上传的那张图片
}
$rs_tid=$imginfo;
}
$pics=substr($pics,0,-1);
$links=substr($links,0,-1);
$texts=substr($texts,0,-1);
$pics='$pics="'.$pics.'";';
$links='$links="'.$links.'";';
$texts='$texts="'.$texts.'";';
$imgcontent = $imgcontent.$pics."\n".$links."\n".$texts."\n?>";
writeover($cachepics,$imgcontent);
}
@require_once($cachepics);
//幻灯图结束
//主题排行+会员排行开始
$cachelist=R_P."data/bbscache/index_toplist.php";//主题排行缓存文件
$cachelisttime=60;//主题排行自动更新时间,单位秒
//下一句设置要显示的板块类型,forum开放板块,former正规板块,hidden隐藏板块
$showforum="(pf.f_type = 'forum' or pf.f_type = 'former')";
if(($timestamp-@filemtime($cachelist)>=$cachelisttime)){
$listnum=10;//主题显示个数
$listlength=48;//主题标题长度
$memberposttoday=$memberpostmonth=$newthreads=$replythreads=$digestthreads=$hotthreads="";
//会员当日发帖排行开始
$query=$db->query("SELECT m.uid,m.username,md.postnum,md.digests,md.rvrc,md.money,md.todaypost,md.onlinetime FROM pw_members m LEFT JOIN pw_memberdata md USING(uid) WHERE md.lastpost>'$tdtime' ORDER BY md.todaypost DESC limit 0,$listnum");
$c_i=1;//初始化图片序号
while($members=$db->fetch_array($query)){
$members=(int)($members/3600);
$i=0;
while((5*$i*$i+15*$i)<=$members){
$i++;
$C=5*$i*$i+15*$i;
$N=$i;
}
$more=$C-$members;
$lv=$N;
if($lv > 48) $lv = 48;
$memberposttoday.="<img src='$imgpath/top/c_".$c_i.".gif' align='absmiddle' width='11' height='11'> <a href='profile.php?action=show&uid=$members' title='发帖:$members 帖\n精华:$members 帖\n威望:$members 点\n财富:$members 禾氏币\n在线等级:$lv 级\n在线时间:$members 小时\n升级剩余:$more 小时'>$members</a> <span style='color:red'>$members</span> 帖<br />";
$c_i++;
}
unset($members);
unset($c_i);
//会员当日发帖排行结束
//会员本月发帖排行开始
$query=$db->query("SELECT m.uid,m.username,md.postnum,md.digests,md.rvrc,md.money,md.monthpost,md.onlinetime FROM pw_members m LEFT JOIN pw_memberdata md USING(uid) WHERE md.lastpost>'$montime' ORDER BY md.monthpost DESC limit 0,$listnum");
$c_i=1;//初始化图片序号
while($members=$db->fetch_array($query)){
$members=(int)($members/3600);
$i=0;
while((5*$i*$i+15*$i)<=$members){
$i++;
$C=5*$i*$i+15*$i;
$N=$i;
}
$more=$C-$members;
$lv=$N;
if($lv > 48) $lv = 48;
$memberpostmonth.="<img src='$imgpath/top/c_".$c_i.".gif' align='absmiddle' width='11' height='11'> <a href='profile.php?action=show&uid=$members' title='发帖:$members 帖\n精华:$members 帖\n威望:$members 点\n财富:$members 禾氏币\n在线等级:$lv 级\n在线时间:$members 小时\n升级剩余:$more 小时'>$members</a> <span style='color:red'>$members</span> 帖<br />";
$c_i++;
}
unset($members);
unset($c_i);
//会员本月发帖排行结束
//最新发表主题开始
$query = $db->query("SELECT pt.tid,pt.author,pt.subject,pt.postdate,pt.hits,pf.name,pf.fid FROM pw_threads pt LEFT JOIN pw_forums pf USING(fid) where pt.ifcheck='1' and ".$showforum." and pf.password = '' order by pt.postdate desc limit 0,$listnum");
$c_i=1;//初始化图片序号
while($threads=$db->fetch_array($query)){
$threads=get_date($threads);
$subject=substrs($threads,$listlength);
$newthreads.="<img src='$imgpath/top/c_".$c_i.".gif' align='absmiddle' width='11' height='11'> <a href='thread.php?fid=$threads'>[$threads]</a> <a href='read.php?tid=$threads' title='主题标题:$threads\n主题作者:$threads\n发表时间:$threads\n浏览次数:$threads 次'>$subject</a><br />";
$c_i++;
}
unset($threads);
unset($c_i);
//最新发表主题结束
//最新回复主题开始
$query = $db->query("SELECT pt.tid,pt.author,pt.subject,pt.postdate,pt.lastpost,pt.lastposter,pt.hits,pt.replies,pf.name,pf.fid FROM pw_threads pt LEFT JOIN pw_forums pf USING(fid) where pt.ifcheck = '1' and pt.replies > 0 and ".$showforum." and pf.password = '' order by lastpost desc limit 0,$listnum");
$c_i=1;//初始化图片序号
while($threads=$db->fetch_array($query)){
$threads=get_date($threads);
$threads=get_date($threads);
$subject=substrs($threads,$listlength);
$replythreads.="<img src='$imgpath/top/c_".$c_i.".gif' align='absmiddle' width='11' height='11'> <a href='thread.php?fid=$threads'>[$threads]</a> <a href='read.php?tid=$threads' title='主题标题:$threads\n主题作者:$threads\n发表时间:$threads\n浏览次数:$threads 次\n最新回复:$threads\n回复时间:$threads\n回复次数:$threads 次'>$subject</a><br />";
$c_i++;
}
unset($threads);
unset($c_i);
//最新回复主题结束
//社区精华主题开始
$query = $db->query("SELECT pt.tid,pt.author,pt.subject,pt.postdate,pt.lastpost,pt.lastposter,pt.hits,pt.replies,pf.name,pf.fid FROM pw_threads pt LEFT JOIN pw_forums pf USING(fid) where pt.ifcheck='1' and pt.digest > 0 and ".$showforum." and pf.password = '' order by pt.postdate desc limit 0,$listnum");
$c_i=1;//初始化图片序号
while($threads=$db->fetch_array($query)){
$threads=get_date($threads);
$threads=get_date($threads);
$subject=substrs($threads,$listlength);
$digestthreads.="<img src='$imgpath/top/c_".$c_i.".gif' align='absmiddle' width='11' height='11'> <a href='thread.php?fid=$threads'>[$threads]</a> <a href='read.php?tid=$threads' title='主题标题:$threads\n主题作者:$threads\n发表时间:$threads\n浏览次数:$threads 次\n最新回复:$threads\n回复时间:$threads\n回复次数:$threads 次'>$subject</a><br />";
$c_i++;
}
unset($threads);
unset($c_i);
//社区精华主题结束
//最多点击主题开始
$query = $db->query("SELECT pt.tid,pt.author,pt.subject,pt.postdate,pt.lastpost,pt.lastposter,pt.hits,pt.replies,pf.name,pf.fid FROM pw_threads pt LEFT JOIN pw_forums pf USING(fid) where pt.ifcheck = '1' and ".$showforum." and pf.password = '' order by hits desc limit 0,$listnum");
$c_i=1;//初始化图片序号
while($threads=$db->fetch_array($query)){
$threads=get_date($threads);
$threads=get_date($threads);
$subject=substrs($threads,$listlength);
$hotthreads.="<img src='$imgpath/top/c_".$c_i.".gif' align='absmiddle' width='11' height='11'> <a href='thread.php?fid=$threads'>[$threads]</a> <a href='read.php?tid=$threads' title='主题标题:$threads\n主题作者:$threads\n发表时间:$threads\n浏览次数:$threads 次\n最新回复:$threads\n回复时间:$threads\n回复次数:$threads 次'>$subject</a><br />";
$c_i++;
}
unset($threads);
unset($c_i);
//最多点击主题结束
@writeover($cachelist,"<?php\n\$memberposttoday=\"$memberposttoday\";\n\$memberpostmonth=\"$memberpostmonth\";\n\$newthreads=\"$newthreads\";\n\$replythreads=\"$replythreads\";\n\$digestthreads=\"$digestthreads\";\n\$hotthreads=\"$hotthreads\";\n?>");
}
@require_once($cachelist);
//主题排行+会员排行结束
//首页调用结束
print <<<EOT
-->
再找到如下的代码
共 $topics 篇主题 | $article 篇帖子 | $totalmember 位会员 | 欢迎新会员 <a href="profile.php?action=show&username=$rawnewuser" target="_blank">$newmember</a>
</td>
</tr>
</table></div>
在上面的代码下方插入下面的代码
<!-- 主题排行+会员排行开始 -->
<!-- 主题排行脚本控制开始 -->
<SCRIPT language=javascript>
var nn1=1;
change_list1();
function change_list1()
{
if(nn1>4) nn1=1
yy1=setTimeout('setFocus1('+nn1+')',9000);
nn1++;
tt1=setTimeout('change_list1()',9000);
}
function stop_change_list1()
{
window.clearTimeout(tt1);
window.clearTimeout(yy1);
}
function setFocus1(i)
{
selectLayer1(i);
}
function selectLayer1(i)
{
switch(i)
{
case 1:
document.getElementById("focusList1").style.display="block";
document.getElementById("focusList2").style.display="none";
document.getElementById("focusList3").style.display="none";
document.getElementById("focusList4").style.display="none";
break;
case 2:
document.getElementById("focusList1").style.display="none";
document.getElementById("focusList2").style.display="block";
document.getElementById("focusList3").style.display="none";
document.getElementById("focusList4").style.display="none";
break;
case 3:
document.getElementById("focusList1").style.display="none";
document.getElementById("focusList2").style.display="none";
document.getElementById("focusList3").style.display="block";
document.getElementById("focusList4").style.display="none";
break;
case 4:
document.getElementById("focusList1").style.display="none";
document.getElementById("focusList2").style.display="none";
document.getElementById("focusList3").style.display="none";
document.getElementById("focusList4").style.display="block";
break;
}
}
</SCRIPT>
<SCRIPT language=javascript>
function setFocus11(i)
{
stop_change_list1();
selectLayer1(i);
}
</SCRIPT>
<!-- 主题排行脚本控制结束 -->
<!-- 会员排行脚本控制开始 -->
<SCRIPT language=javascript>
var nn2=1;
change_list2();
function change_list2()
{
if(nn2>2) nn2=1
yy2=setTimeout('setFocus2('+nn2+')',6000);
nn2++;
tt2=setTimeout('change_list2()',6000);
}
function stop_change_list2()
{
window.clearTimeout(tt2);
window.clearTimeout(yy2);
}
function setFocus2(i)
{
selectLayer2(i);
}
function selectLayer2(i)
{
switch(i)
{
case 1:
document.getElementById("focusListM1").style.display="block";
document.getElementById("focusListM2").style.display="none";
break;
case 2:
document.getElementById("focusListM1").style.display="none";
document.getElementById("focusListM2").style.display="block";
break;
}
}
</SCRIPT>
<SCRIPT language=javascript>
function setFocus22(i)
{
stop_change_list2();
selectLayer2(i);
}
</SCRIPT>
<!-- 会员排行脚本控制结束 -->
<div class="t">
<table cellspacing="0" cellpadding="0" width="100%">
<tr class="tr3">
<td align="center" width="22%">
<script type="text/javascript">
<!--
var focus_width=220
var focus_height=180
var swf_width = focus_width
var swf_height = focus_height
var pics="$pics"
var links="$links"
document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+ swf_width +'" height="'+ swf_height +'">');
document.write('<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="{$imgpath}/pixviewer.swf"><param name="quality" value="high"><param name="bgcolor" value="#F4FBFF">');
document.write('<param name="menu" value="false"><param name=wmode value="opaque">');
document.write('<param name="FlashVars" value="pics='+pics+'&links='+links+'&borderwidth='+focus_width+'&borderheight='+focus_height+'">');
document.write('<embed src="{$imgpath}/pixviewer.swf" wmode="opaque" FlashVars="pics='+pics+'&links='+links+'&borderwidth='+focus_width+'&borderheight='+focus_height+'" menu="false" bgcolor="#F4FBFF" quality="high" width="'+ swf_width +'" height="'+ swf_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
document.write('</object>');
//-->
</script>
</td>
<td style="vertical-align:top;" width="48%">
<DIV id=focusList1 style="DISPLAY: block">
<table cellspacing="2" cellpadding="2" width="100%">
<tr align="center" class="tr4">
<td bgcolor="#A6CBE7"><span class="b"><a href="javascript:setFocus11(1);" target="_self">最新主题</a></span></td>
<td><a href="javascript:setFocus11(2);" target="_self" style="color:#CCCCCC">最新回复</a></td>
<td><a href="javascript:setFocus11(3);" target="_self" style="color:#CCCCCC">精华主题</a></td>
<td><a href="javascript:setFocus11(4);" target="_self" style="color:#CCCCCC">热门主题</a></td>
<td>主题排行</td>
</tr>
</table>
$newthreads
</DIV>
<DIV id=focusList2 style="DISPLAY: none">
<table cellspacing="2" cellpadding="2" width="100%">
<tr align="center" class="tr4">
<td><a href="javascript:setFocus11(1);" target="_self" style="color:#CCCCCC">最新主题</a></td>
<td bgcolor="#A6CBE7"><span class="b"><a href="javascript:setFocus11(2);" target="_self">最新回复</a></span></td>
<td><a href="javascript:setFocus11(3);" target="_self" style="color:#CCCCCC">精华主题</a></td>
<td><a href="javascript:setFocus11(4);" target="_self" style="color:#CCCCCC">热门主题</a></td>
<td>主题排行</td>
</tr>
</table>
$replythreads
</DIV>
<DIV id=focusList3 style="DISPLAY: none">
<table cellspacing="2" cellpadding="2" width="100%">
<tr align="center" class="tr4">
<td><a href="javascript:setFocus11(1);" target="_self" style="color:#CCCCCC">最新主题</a></td>
<td><a href="javascript:setFocus11(2);" target="_self" style="color:#CCCCCC">最新回复</a></td>
<td bgcolor="#A6CBE7"><span class="b"><a href="javascript:setFocus11(3);" target="_self">精华主题</a></span></td>
<td><a href="javascript:setFocus11(4);" target="_self" style="color:#CCCCCC">热门主题</a></td>
<td>主题排行</td>
</tr>
</table>
$digestthreads
</DIV>
<DIV id=focusList4 style="DISPLAY: none">
<table cellspacing="2" cellpadding="2" width="100%">
<tr align="center" class="tr4">
<td><a href="javascript:setFocus11(1);" target="_self" style="color:#CCCCCC">最新主题</a></td>
<td><a href="javascript:setFocus11(2);" target="_self" style="color:#CCCCCC">最新回复</a></td>
<td><a href="javascript:setFocus11(3);" target="_self" style="color:#CCCCCC">精华主题</a></td>
<td bgcolor="#A6CBE7"><span class="b"><a href="javascript:setFocus11(4);" target="_self">热门主题</a></span></td>
<td>主题排行</td>
</tr>
</table>
$hotthreads
</DIV>
</td>
<td style="vertical-align:top;" width="30%">
<DIV id=focusListM1 style="DISPLAY: block">
<table cellspacing="2" cellpadding="2" width="100%">
<tr align="center" class="tr4">
<td bgcolor="#A6CBE7"><span class="b"><a href="javascript:setFocus22(1);" target="_self">今日发帖</a></span></td>
<td><a href="javascript:setFocus22(2);" target="_self" style="color:#CCCCCC">本月发帖</a></td>
<td>会员排行</td>
</tr>
</table>
$memberposttoday
</DIV>
<DIV id=focusListM2 style="DISPLAY: none">
<table cellspacing="2" cellpadding="2" width="100%">
<tr align="center" class="tr4">
<td><a href="javascript:setFocus22(1);" target="_self" style="color:#CCCCCC">今日发帖</a></td>
<td bgcolor="#A6CBE7"><span class="b"><a href="javascript:setFocus22(2);" target="_self">本月发帖</a></span></td>
<td>会员排行</td>
</tr>
</table>
$memberpostmonth
</DIV>
</td>
</tr>
</table>
</div>
<!-- 主题排行+会员排行结束 -->
顶顶载下来看看.... 看帖子的要发表下看法 xuexi...... 这个东西 不明白
页:
[1]