岁月如歌

追寻先知的足迹……探寻价值投资之路。

« 博客左侧广告文案ZBLOG修改显示阅读全文链接 »

ZBLOG修改RSS中添加相关文章

根据月光的文章,修改部分ZBLOG的功能,美化了RSS显示,然后又修改了全文RSS输出,但没有成功,之后又看到http://zxmys.com/post/101.html 然后重新做了一次,竟然成功,归纳修改方法如下:

打开c_system_event.asp文件
找到Function ExportRSS()函数
把原有objArticle.HtmlIntro改为
objArticle.HtmlIntro+getRelateList(objArticle.ID,objArticle.Tag,objArticle.Title,objArticle.URL)
把原有objArticle.HtmlContent改为
objArticle.HtmlContent+getRelateList(objArticle.ID,objArticle.Tag,objArticle.Title,objArticle.URL)
 

打开c_system_event.asp文件,在文件尾部增加下列代码:

'*********************************************************
' 目的:相关文章和增加评论连接的生成,用于优化Feed和增加评论连接
'*********************************************************
'*********************************************************
Function getRelateList(intID,strTag,strTitle,strURL)

If (intID=0) Then Exit Function
If strTag<>"" Then

Dim strCC_Count,strCC_ID,strCC_Name,strCC_Url,strCC_PostTime,strCC_Title
Dim strCC
Dim i
Dim j
Dim objRS
Dim strSQL

Dim strOutput
strOutput=""

Set objRS=Server.CreateObject("ADODB.Recordset")

strSQL="SELECT top 10  [log_ID],[log_Tag],[log_CateID],[log_Title],[log_Intro],[log_Level],[log_AuthorID],[log_PostTime],[log_Url] FROM [blog_Article] WHERE ([log_Level]>2) AND [log_ID]<>"& intID &" "

strSQL = strSQL & " AND ("

Dim aryTAGs
strTag=Replace(strTag,"}","")
aryTAGs=Split(strTag,"{")

For j = LBound(aryTAGs) To UBound(aryTAGs)
If aryTAGs(j)<>"" Then
strSQL = strSQL & "([log_Tag] Like '%{"&aryTAGs(j)&"}%')"
If j=UBound(aryTAGs) Then Exit For
If aryTAGs(j)<>"" Then strSQL = strSQL & " OR "
End If
Next

strSQL = strSQL & ")"
strSQL = strSQL + " ORDER BY [log_PostTime] DESC "

Set objRS=Server.CreateObject("ADODB.Recordset")
objRS.CursorType = adOpenKeyset
objRS.LockType = adLockReadOnly
objRS.ActiveConnection=objConn
objRS.Source=strSQL
objRS.Open()
If (Not objRS.bof) And (Not objRS.eof) Then

For i=1 To 5 '相关文章数目,可自行设定
Dim objArticle
Set objArticle=New TArticle

If objArticle.LoadInfoByArray(Array(objRS("log_ID"),objRS("log_Tag"),objRS("log_CateID"),objRS("log_Title"),"","",objRS("log_Level"),objRS("log_AuthorID"),objRS("log_PostTime"),"","","",objRS("log_Url"),"")) Then

strCC_Count=strCC_Count+1
strCC_ID=objArticle.ID
strCC_Url=objArticle.Url
strCC_PostTime=objArticle.PostTime
strCC_Title=objArticle.Title

Application.Lock
strCC=Application(ZC_BLOG_CLSID & "TEMPLATE_B_ARTICLE_Mutuality")
Application.UnLock

strCC=Replace(strCC,"<#article/mutuality/id#>",strCC_ID)
strCC=Replace(strCC,"<#article/mutuality/url#>",strCC_Url)
strCC=Replace(strCC,"<#article/mutuality/posttime#>",strCC_PostTime)
strCC=Replace(strCC,"<#article/mutuality/name#>",strCC_Title)
strOutput=strOutput & strCC

end if
Set objArticle=nothing
objRS.MoveNext
If objRS.eof Then Exit For
Next

End if

objRS.Close()
Set objRS=Nothing
End If
strOutput=Replace(strOutput,vbCrlf,"")
getRelateList= "<br/><a href="""+strURL+"#comment"" target=""_blank"">对《"+strTitle+"》发表评论</a><br/><br/>"
IF strOutput<>"" then
getRelateList=  getRelateList+"<br/><br/>相关文章:<ul>" + strOutput + "</ul><br/>"
end if

End Function
 

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

日历

最新评论及回复

最近发表

Powered By Z-Blog 1.8 Spirit Build 80722 Code detection by Codefense

粤ICP备05029832号 Copyright Rights Reserved.