zblog用了6年,至今一直用的是最經(jīng)典的zblog 1.8 asp版,后面不想升級(jí)主要是不想折騰,覺(jué)得沒(méi)這個(gè)必要,現(xiàn)在這個(gè)版本用得很好。不過(guò)話又說(shuō)回來(lái),zblog的后臺(tái)管理界面確實(shí)太簡(jiǎn)單了,有一些信息我們并不能直接從后臺(tái)獲取,例如文章的瀏覽數(shù)量,評(píng)論數(shù)量等,而文章的瀏覽數(shù)量是我最近比較關(guān)注的問(wèn)題。
由于對(duì)zblog的asp程序比較了解,插件也開(kāi)發(fā)了好幾個(gè),所以我想能否通過(guò)更改下后臺(tái)管理程序,滿足自己的需要,在文章管理界面直接顯示每篇文章的瀏覽數(shù)。
程序修改起來(lái)很容易,甚至不用任何調(diào)試,很快就改好了??纯聪旅娴男陆缑姘?。
zblog文章管理界面
“瀏覽”一列是新增的。
加了這一列后,可以很方便的看到哪些文章更受歡迎,哪些文章的用戶群更多,使我們明白如何去更新網(wǎng)站和SEO優(yōu)化。
下面附上代碼。
打開(kāi)文件
\FUNCTION\c_system_manage.asp
找到如下函數(shù)
'*********************************************************
' 目的: Manager Articles
'*********************************************************
Function ExportArticleList(intPage,intCate,intLevel,intTitle)
... ...
End Function
'*********************************************************
然后替換為
'*********************************************************
' 目的: Manager Articles
'*********************************************************
Function ExportArticleList(intPage,intCate,intLevel,intTitle)
Call Add_Response_Plugin("Response_Plugin_ArticleMng_SubMenu",MakeSubMenu(ZC_MSG168 & "(" & ZC_MSG100 & ")","../cmd.asp?act=ArticleEdt&type=" & ZC_BLOG_WEBEDIT,"m-left",False))
Call Add_Response_Plugin("Response_Plugin_ArticleMng_SubMenu",MakeSubMenu(ZC_MSG168 & "(" & ZC_MSG101 & ")","../cmd.asp?act=ArticleEdt","m-left",False))
Dim i
Dim objRS
Dim strSQL
Dim strPage
Dim intPageAll
Call CheckParameter(intPage,"int",1)
Call CheckParameter(intCate,"int",-1)
Call CheckParameter(intLevel,"int",-1)
Call CheckParameter(intTitle,"sql",-1)
intTitle=vbsunescape(intTitle)
intTitle=FilterSQL(intTitle)
Response.Write "<div class=""Header"">" & ZC_MSG067 & "</div>"
Response.Write "<div class=""SubMenu"">" & Response_Plugin_ArticleMng_SubMenu & "</div>"
Response.Write "<div id=""divMain2"">"
Call GetBlogHint()
Response.Write "<form id=""edit"" method=""post"" enctype=""application/x-www-form-urlencoded"" action=""../admin/admin.asp?act=ArticleMng"">"
Response.Write "<p>"&ZC_MSG158&":</p><p>"
Response.Write ZC_MSG012&" <select class=""edit"" size=""1"" id=""cate"" name=""cate"" style=""width:100px;"" ><option value=""-1"">"&ZC_MSG157&"</option> "
Dim Category
For Each Category in Categorys
If IsObject(Category) Then
Response.Write "<option value="""&Category.ID&""" "
Response.Write ">"&TransferHTML(Category.Name,"[html-format]")&"</option>"
End If
Next
Response.Write "</select> "
Response.Write ZC_MSG061&" <select class=""edit"" size=""1"" id=""level"" name=""level"" style=""width:80px;"" ><option value=""-1"">"&ZC_MSG157&"</option> "
For i=LBound(ZVA_Article_Level_Name)+1 to Ubound(ZVA_Article_Level_Name)
Response.Write "<option value="""&i&""" "
Response.Write ">"&ZVA_Article_Level_Name(i)&"</option>"
Next
Response.Write "</select>"
Response.Write " "&ZC_MSG224&" <input id=""title"" name=""title"" style=""width:150px;"" type=""text"" value="""" /> "
Response.Write "<input type=""submit"" class=""button"" value="""&ZC_MSG087&""">"
Response.Write "</p></form>"
Set objRS=Server.CreateObject("ADODB.Recordset")
objRS.CursorType = adOpenKeyset
objRS.LockType = adLockReadOnly
objRS.ActiveConnection=objConn
objRS.Source=""
strSQL="WHERE ([log_Level]>0) AND (true=true) "
If CheckRights("Root")=False Then strSQL= strSQL & "AND [log_AuthorID] = " & BlogUser.ID
If intCate<>-1 Then
strSQL= strSQL & " AND [log_CateID] = " & intCate
End If
If intLevel<>-1 Then
strSQL= strSQL & " AND [log_Level] = " & intLevel
End If
If intTitle<>"-1" Then
strSQL = strSQL & "AND ( (InStr(1,LCase([log_Title]),LCase('" & intTitle &"'),0)<>0) OR (InStr(1,LCase([log_Intro]),LCase('" & intTitle &"'),0)<>0) OR (InStr(1,LCase([log_Content]),LCase('" & intTitle &"'),0)<>0) )"
End If
Response.Write "<table border=""1"" width=""100%"" cellspacing=""1"" cellpadding=""1"">"
Response.Write "<tr><td>"& ZC_MSG076 &"</td><td>"& ZC_MSG012 &"</td><td>"& ZC_MSG003 &"</td><td>"& ZC_MSG075 &"</td><td>"& ZC_MSG060 &"</td><td>"& ZC_MSG130 &"</td><td></td><td></td><td></td></tr>"
objRS.Open("SELECT * FROM [blog_Article] "& strSQL &" ORDER BY [log_PostTime] DESC")
objRS.PageSize=ZC_MANAGE_COUNT
If objRS.PageCount>0 Then objRS.AbsolutePage = intPage
intPageAll=objRS.PageCount
If (Not objRS.bof) And (Not objRS.eof) Then
For i=1 to objRS.PageSize
Response.Write "<tr>"
Response.Write "<td>" & objRS("log_ID") & "</td>"
Dim Cate
For Each Cate in Categorys
If IsObject(Cate) Then
If Cate.ID=objRS("log_CateID") Then
Response.Write "<td>" & Left(Cate.Name,6) & "</td>"
End If
End If
Next
Dim User
For Each User in Users
If IsObject(User) Then
If User.ID=objRS("log_AuthorID") Then
Response.Write "<td>" & User.Name & "</td>"
End If
End If
Next
'Response.Write "<td>" & ZVA_Article_Level_Name(objRS("log_Level")) & "</td>"
Response.Write "<td>" & FormatDateTime(objRS("log_PostTime"),vbShortDate) & "</td>"
If Len(objRS("log_Title"))>14 Then
Response.Write "<td><a href=""../view.asp?id=" & objRS("log_ID") & """ title="""& Replace(objRS("log_Title"),"""","") &""" target=""_blank"">" & Left(objRS("log_Title"),14) & "..." & "</a></td>"
Else
Response.Write "<td><a href=""../view.asp?id=" & objRS("log_ID") & """ title="""& Replace(objRS("log_Title"),"""","") &""" target=""_blank"">" & objRS("log_Title") & "</a></td>"
End If
Response.Write "<td>" & objRS("log_ViewNums") & "</td>"
Response.Write "<td align=""center""><a href=""../cmd.asp?act=ArticleEdt&type="& ZC_BLOG_WEBEDIT &"&id=" & objRS("log_ID") & """>[" & ZC_MSG100 & "]</a></td>"
Response.Write "<td align=""center""><a href=""../cmd.asp?act=ArticleEdt&id=" & objRS("log_ID") & """>[" & ZC_MSG101 & "]</a></td>"
Response.Write "<td align=""center""><a onclick='return window.confirm("""& ZC_MSG058 &""");' href=""../cmd.asp?act=ArticleDel&id=" & objRS("log_ID") & """>[" & ZC_MSG063 & "]</a></td>"
Response.Write "</tr>"
objRS.MoveNext
If objRS.eof Then Exit For
Next
End If
Response.Write "</table>"
'For i=1 to objRS.PageCount
' strPage=strPage &"<a href='../admin/admin.asp?act=ArticleMng&page="& i &"&cate="&ReQuest("cate")&"&level="&ReQuest("level")&"&title="&Escape(ReQuest("title"))&"'>["& Replace(ZC_MSG036,"%s",i) &"]</a> "
'Next
strPage=ExportPageBar(intPage,intPageAll,ZC_PAGEBAR_COUNT,"../admin/admin.asp?act=ArticleMng&cate="&ReQuest("cate")&"&level="&ReQuest("level")&"&title="&Escape(ReQuest("title")) & "&page=")
Response.Write "<hr/>" & ZC_MSG042 & ": " & strPage
Response.Write "</div>"
objRS.Close
Set objRS=Nothing
ExportArticleList=True
End Function
'*********************************************************
紅色標(biāo)記的代碼是添加的部分。
請(qǐng)注意,這個(gè)是zblog1.8版本的程序,不一定適合其他版本,更新前請(qǐng)先備份程序。