3.0增加上一篇、下一篇功能_风讯Cms教程

编辑Tag赚U币
教程Tag:暂无Tag,欢迎添加,赚取U币!

使用方法:在需要调用的地方直接调用“{FS_上一篇}”和{FS_下一篇}标签就行了。

最终效果如:

上一篇:6日IT:赛门铁克公布完成Veritas收购交易
下一篇:日本政府出售中日本铁路价值46亿美元的股份

修改方法:

打开修改/admin/Refresh/Function.asp文件

第一步,在第一行<%后(也就是第二行)增加

dim NextTempStr,PreviousTempStr

第二步,在Content = GetVisionStr & Content这一行

在下面增加

Content = Replace(Content,"{FS_上一篇}",PreviousTempStr)
Content = Replace(Content,"{FS_下一篇}",NextTempStr)

第三步,找到Function RefreshNews(NewsRecordSetObj)

在下面增加

'生成上一篇下一篇
dim NowNewsID,NowClassID
NowNewsID = NewsRecordSetObj("ID")
NowClassID = NewsRecordSetObj("ClassID")
dim NextSql,NextRs,NextClassRs
'上一篇
NextSql = "Select TOP 1 id,NewsID,ClassID,Title,Path,FileName,FileExtName From News where ID < " & NowNewsID & " and ClassID = '" & NowClassID & "' order by id desc"
Set NextRs = Conn.Execute(NextSql)
If NextRs.eof or NextRs.bof Then
PreviousTempStr = "上一篇:没有了"
Else
Set NextClassRs = Conn.Execute("Select SaveFilePath,ClassEName from NewsClass where ClassID='" & NowClassID & "'")
If not NextRs.eof then PreviousTempStr = "上一篇:<a href='" & NextClassRs(0) & "/" & NextClassRs(1) & "/" & NextRs(5) & "." & NextRs(6) & "' title ='"&NextRs(3)&"'>"&NextRs(3)&"</a>"
NextClassRs.Close
Set NextClassRs = nothing
NextRs.Close
Set NextRs = nothing
End If
'下一篇
NextSql = "Select TOP 1 id,NewsID,ClassID,Title,Path,FileName,FileExtName From News where ID > " & NowNewsID & " and ClassID = '" & NowClassID & "' order by id"
Set NextRs = Conn.Execute(NextSql)
If NextRs.eof or NextRs.bof Then
NextTempStr = "下一篇:没有了"
Else
Set NextClassRs = Conn.Execute("Select SaveFilePath,ClassEName from NewsClass where ClassID='" & NowClassID & "'")
If not NextRs.eof then NextTempStr = "下一篇:<a href='" & NextClassRs(0) & "/" & NextClassRs(1) & "/" & NextRs(5) & "." & NextRs(6) & "' title ='"&NextRs(3)&"'>"&NextRs(3)&"</a>"
NextClassRs.Close
Set NextClassRs = nothing
NextRs.Close
Set NextRs = nothing
End If
'完成

讨论区: http://bbs.foosun.net/dispbbs.asp?boardID=22&ID=5366&page=1

查看更多 风讯cms教程  风讯cms模板

来源:模板无忧//所属分类:风讯Cms教程/更新时间:2006-06-16
相关风讯Cms教程