Z-blog 博客添加读者墙页面
前面河南网站建设介绍了WordPress读者墙插件,之后想找Z-Blog博客的读者墙插件,但一直没有找到,可能是没有人制作相关的插件吧。后来石头的博客发表了一篇利用评论之星插件给Z-Blog添加读者墙页面的文章,并亲切地命名为“朋友圈”,现在河南网站建设将其找到并转载过来,供需要的朋友参考研究学习使用。
Z-Blog博客墙制作方法步骤:
使用记事本或Dreamweaver,复制以下代码到其中并保存为guest.asp(名字随自己喜欢),文档的编码选为UTF-8;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
<%@ CODEPAGE=65001 %> <% '/////////////////////////////////////////////////////////////////////////////// '// Z-Blog '// 作 者: 朱煊(zx.asd) '// 版权所有: RainbowSoft Studio '// 技术支持: rainbowsoft@163.com '// 程序名称: '// 程序版本: '// 单元名称: '// 开始时间: 2004.07.25 '// 最后修改: '// 备 注: '/////////////////////////////////////////////////////////////////////////////// %> <% Option Explicit %> <% On Error Resume Next %> <% Response.Charset="UTF-8" %> <% Response.Buffer=True %> <!-- #include file="c_option.asp" --> <!-- #include file="function/c_function.asp" --> <!-- #include file="function/c_function_md5.asp" --> <!-- #include file="function/c_system_lib.asp" --> <!-- #include file="function/c_system_base.asp" --> <!-- #include file="function/c_system_event.asp" --> <!-- #include file="function/c_system_plugin.asp" --> <!-- #include file="plugin/p_config.asp" --> <% Call System_Initialize_WithOutDB() Dim ArtList Set ArtList=New TArticleList ArtList.LoadCache ArtList.template="GUEST" If ArtList.ExportByCache("","","","","","") Then ArtList.Build Response.Write ArtList.html End If Call System_Terminate_WithOutDB() %><!-- <%=RunTime()%>ms --><% If Err.Number<>0 then Call ShowError(0) End If %>
使用记事本或Dreamweaver,新建一个html文件,把你的模板代码复制进去,在要调用读者墙的地方插入标签“<#CACHE_INCLUDE_CMTSTAR#>”,并另存为guest.html,注意编码是UTF-8格式的;(这里可以使用index.html文件,把文件中调用摘要的代码替换为<#CACHE_INCLUDE_CMTSTAR#>
下载Z-Blog博客插件评论之星并安装激活(可以在Z-blog博客后台的插件管理里直接安装)
在Z-Blog博客后台的“文件管理”中修改PLUGIN\CmtStar目录中的include.asp文件,将代码替换为以下代码内容:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275
<% '/////////////////////////////////////////////////////////////////////////////// '// 插件应用: 1.8 Devo 其它版本的Z-blog未知 '// 插件制作: haphic(http://haphic.com/) '// 备 注: CmtStar - 挂口页 '// 最后修改: 2009-12-2 '// 最后版本: 0.1 '/////////////////////////////////////////////////////////////////////////////// Const CmtStar_DayNum = 365 Const CmtStar_Num = 500 Const CmtStar_Level = 1 Const CmtStar_AlwaysShowLinks = True Const CmtStar_DefaultLink = "" Const CmtStar_ThisMonthOnly = False Const CmtStar_BlockedName = "" '注册插件 Call RegisterPlugin("CmtStar","ActivePlugin_CmtStar") Function ActivePlugin_CmtStar() '挂上接口 'Call Add_Action_Plugin("Action_Plugin_MakeBlogReBuild_Begin","Call CmtStar_BuildCache") Call Add_Action_Plugin("Action_Plugin_MakeBlogReBuild_Core_Begin","Call CmtStar_BuildCache:Call ClearGlobeCache():Call LoadGlobeCache()") 'Call Add_Action_Plugin("Action_Plugin_CommentPost_Succeed","Call CmtStar_BuildCache:Call ClearGlobeCache():Call LoadGlobeCache()") End Function Function CmtStar_BuildCache() On Error Resume Next Dim aryCmtName() Dim aryCmtNum() Dim aryCmtUrl() Dim aryCmtEmail() Dim tmpCmtName Dim tmpCmtNum Dim tmpCmtUrl Dim tmpCmtEmail Dim i : i=0 Dim j : j=0 Dim k : k=0 Dim bolNameFound ReDim Preserve aryCmtName(i) ReDim Preserve aryCmtNum(i) ReDim Preserve aryCmtUrl(i) ReDim Preserve aryCmtEmail(i) '从数据库中取得数据 Dim objRS If CmtStar_ThisMonthOnly Then Set objRS=objConn.Execute("SELECT [comm_Author],[comm_HomePage],[comm_Email] FROM [blog_Comment] WHERE ([log_ID]>=0) AND (Year([comm_PostTime])="&Year(Now())&") AND (Month([comm_PostTime])="&Month(Now())&") ORDER BY [comm_ID] DESC") Else Set objRS=objConn.Execute("SELECT [comm_Author],[comm_HomePage],[comm_Email] FROM [blog_Comment] WHERE ([log_ID]>=0) AND ([comm_PostTime]>Now()-"& CmtStar_DayNum &") ORDER BY [comm_ID] DESC") End If If (Not objRS.bof) And (Not objRS.eof) Then Do While Not objRS.eof If CmtStar_NameIllegal(objRS("comm_Author"))=False Then bolNameFound = False For j=0 To UBound(aryCmtName) Step 1 If LCase(aryCmtName(j)) = LCase(objRS("comm_Author")) Then aryCmtNum(j) = aryCmtNum(j)+1 If Len(aryCmtUrl(j)) < 5 Then aryCmtUrl(j) = objRS("comm_HomePage") Else If Not Len(objRS("comm_HomePage"))<5 Then aryCmtUrl(j) = aryCmtUrl(j) & "|" & objRS("comm_HomePage") '取得所有的URL, 字符串 URL|URL|URL 形式. End If End If bolNameFound = True Exit For End If Next If bolNameFound = False Then ReDim Preserve aryCmtName(i) ReDim Preserve aryCmtNum(i) ReDim Preserve aryCmtUrl(i) ReDim Preserve aryCmtEmail(i) aryCmtName(i) = objRS("comm_Author") aryCmtNum(i) = 1 aryCmtUrl(i) = objRS("comm_HomePage") aryCmtEmail(i) = objRS("comm_Email") i=i+1 End If End If objRS.MoveNext Loop End If objRS.Close Set objRS=Nothing '滤去评论数小于指定值的评论者 tmpCmtName = aryCmtName tmpCmtNum = aryCmtNum tmpCmtUrl = aryCmtUrl tmpCmtEmail = aryCmtEmail Erase aryCmtName Erase aryCmtNum Erase aryCmtUrl Erase aryCmtEmail j=0 For i=0 To UBound(tmpCmtName) Step 1 If Not tmpCmtNum(i)<CmtStar_Level Then ReDim Preserve aryCmtName(j) ReDim Preserve aryCmtNum(j) ReDim Preserve aryCmtUrl(j) ReDim Preserve aryCmtEmail(j) aryCmtName(j) = tmpCmtName(i) aryCmtNum(j) = tmpCmtNum(i) aryCmtUrl(j) = tmpCmtUrl(i) aryCmtEmail(j) = tmpCmtEmail(i) j=j+1 End If Next Erase tmpCmtName Erase tmpCmtNum Erase tmpCmtUrl Erase tmpCmtEmail '最多原则确定链接, 防冒名 Dim objRegExp, Matches Set objRegExp=new RegExp objRegExp.IgnoreCase =True objRegExp.Global=True Dim m,n,s,t For k=0 To UBound(aryCmtName) Step 1 m = aryCmtUrl(k) t = 0 If InStr(m,"|")>0 Then n=Split(m,"|") For Each s In n If Right(s,1)="/" Then s=Left(s,Len(s)-1) objRegExp.Pattern="("& s &")" Set Matches = objRegExp.Execute(m) If t<Matches.Count Then t=Matches.Count aryCmtUrl(k) = s End If Set Matches = Nothing Next End If Next Set objRegExp=Nothing '排序 k=Ubound(aryCmtName) For i=k To 0 Step -1 For j=0 To i-1 If aryCmtNum(j)<aryCmtNum(j+1) Then tmpCmtName = aryCmtName(j) tmpCmtNum = aryCmtNum(j) tmpCmtUrl = aryCmtUrl(j) tmpCmtEmail = aryCmtEmail(j) aryCmtName(j) = aryCmtName(j+1) aryCmtNum(j) = aryCmtNum(j+1) aryCmtUrl(j) = aryCmtUrl(j+1) aryCmtEmail(j) = aryCmtEmail(j+1) aryCmtName(j+1) = tmpCmtName aryCmtNum(j+1) = tmpCmtNum aryCmtUrl(j+1) = tmpCmtUrl aryCmtEmail(j+1) = tmpCmtEmail End If Next Next '导出评论之星 Dim strCmtLink : strCmtLink=CmtStar_DefaultLink : If Len(strCmtLink)<5 Then strCmtLink=ZC_BLOG_HOST Dim strCmtStar : strCmtStar="" For k=0 To Ubound(aryCmtName) Step 1 If (aryCmtName(k) <> "") Then If k>CmtStar_Num-1 Then Exit For If CmtStar_AlwaysShowLinks Then If Len(aryCmtURL(k))<5 Then aryCmtURL(k)=strCmtLink End If If Len(aryCmtURL(k))<5 Then strCmtStar = strCmtStar & "<img src=""http://www.gravatar.com/avatar/"&md5(aryCmtEmail(k))&"?d=identicon&s=36&r=g"" height=36 widht=36 alt="""& aryCmtName(k) &""" />" & vbCrlf Else strCmtStar = strCmtStar & "<a href="""& URLEncodeForAntiSpam(aryCmtUrl(k)) &""" target=""_blank"">" & "<img src=""http://www.gravatar.com/avatar/"&md5(aryCmtEmail(k))&"?d=identicon&s=36&r=g"" height=36 widht=36 alt="""& aryCmtName(k) &""" /></a>" & vbCrlf End If End If Next Erase aryCmtName Erase aryCmtNum Erase aryCmtUrl strCmtStar=TransferHTML(strCmtStar,"[no-asp]") Call SaveToFile(BlogPath & "/include/CmtStar.asp",strCmtStar,"utf-8",True) Err.Clear End Function Function CmtStar_NameIllegal(ByVal strName) If Len(CmtStar_BlockedName)=<1 Then Exit Function Dim strList,aryList,sList,bolIllegal bolIllegal=False strName=LCase(strName) strList=LCase(CmtStar_BlockedName) 'strList=Replace(strList," ",",") 'strList=Replace(strList," ",",") strList=Replace(strList,";",",") strList=Replace(strList,";",",") strList=Replace(strList,",",",") strList=Replace(strList,",","|") aryList=Split(strList,"|") For Each sList In aryList If sList<>"" Then If sList=strName Then bolIllegal=True Exit For End If End If Next CmtStar_NameIllegal=bolIllegal End Function '安装插件 Function InstallPlugin_CmtStar() Call CmtStar_BuildCache() End Function '卸载插件 Function UnInstallPlugin_CmtStar() On Error Resume Next Dim fso Set fso = Server.CreateObject("Scripting.FileSystemObject") fso.DeleteFile(BlogPath & "INCLUDE/CmtStar.asp") Set fso = Nothing Err.Clear End Function %>
上传guest.asp文件到空间的根目录中,再上传guest.html文件到要添加读者墙的主题TEMPLATE目录下。
在博客后台重建文件,然后浏览http://你的域名/guest.asp就显示读者墙效果了。
本文链接:https://h.finchui.com/zblogcn/1454.html 转载需授权!