在论坛首页版块上面上调用新帖热帖,可以随时查看论坛的最新发帖。
1、打开index.asp在第6行处的:
If BBS94KK.Info(20)="1" then ShowInfo()
的下面加上一行代码:
ShowNewHot()
2、 在最后面的:
%>
的上面加上:- Function ShowNewHot()
- BBS94KK.ShowTable"新帖<span style='margin-left:50%'>热帖</span>","<table width='100%' border='0' cellspacing='0' cellpadding='0'><tr><td style='border-right:1px "&BBS94KK.SkinsPIC(0)&" dotted' width='50%'>"&GetNewTopic(1,5)&"</td><td width='50%'>"&GetNewTopic(2,5)&"</td></tr></table>"
- End Function
- Function GetNewTopic(flag,Num)
- Dim Rs,Sql,Noshow,i,S
- Noshow=BBS94KK.NoShowTopic()
- If BBS94KK.Cache.valid("IndexNewTopic"&Flag) then
- GetNewTopic=BBS94KK.Cache.Value("IndexNewTopic"&Flag)
- Else
- If Noshow="" Then NoShow="0"
- S="":I=0
- If Flag=1 Then
- Sql="select TopicID,Name,Face,Caption,boardid,lasttime,SqlTableID From [KK_topic] where isdel=0 And BoardID not in("&Noshow&") order by lasttime DESC"
- Else
- Sql="select TopicID,Name,Face,Caption,BoardID,LastTime,SqlTableID From [KK_topic] where isdel=0 And BoardID not in("&Noshow&") And DATEDIFF('d',[LastTime],'"&BBS94KK.NowBbsTime&"')<7 order by ReplyNum DESC"
- End If
- Set Rs=BBS94KK.Execute(Sql)
- Do while not Rs.eof
- I=I+1
- If I>Int(Num) Then Exit Do
- S=S&"<tr><td height=25 width=1><img src=""pic/face/"&Rs("face")&".gif""></td><td><a href=""Show.asp?BoardID="&Rs("BoardID")&"&ID="&Rs("topicid")&"&TB="&Rs("SqlTableID")&""">"&BBS94KK.Fun.StrLeft(Rs("Caption"),40)&"</a></td><td><a href=UserInfo.asp?name="&Rs("Name")&">"&Rs("Name")&"</a></td></tr>"
- Rs.movenext
- Loop
- Rs.Close
- GetNewTopic="<table width='100%' border='0' cellspacing='0' cellpadding='0'>"&S&"</table>"
- BBS94KK.Cache.add "IndexNewTopic"&Flag,GetNewTopic,dateadd("n",20,now)
- End If
- End Function
复制代码 3、最后为了使每次发帖刷新缓存,在SaySave.asp的大约290行处找到:
Session(CacheName & "MyInfo") = Empty
在下面加上:
BBS94KK.Cache.clean("IndexNewTopic1")
BBS94KK.Cache.clean("IndexNewTopic2") |