FoosunCMS-增加上一篇、下一篇功能

来自站长百科
跳转至: 导航、​ 搜索

导航:返回上一页

FoosunCMS-增加上一篇、下一篇功能


使用方法:在需要调用的地方直接调用“{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
'完成


参考来源[ ]