我们在做z-blog的内容页优化的时候,会发现要增加descrition就会出现不少的问题。

当我们在页面</title>下写上

<meta name="Description" content="<#article/intro#>" />

那么噩梦就要开始了。你也一定会发现很多的htm代码。。。

网站内容页的description,如果使用<meta name="Description" content="<#article/intro#>" /> 这个来做描述的话,

就会出现一些很恐怖的htm代码,会让你的网站出现致命的错误。

使用了这个函数以后,就可以很好的解决了这个问题。

解决方法:

1.找到blog\FUNCTION\c_system_lib.asp 这个文件。

添加如下函数:
'********************************************************************************
'函数名:RemoveHTML
'功  能:过滤HTML
'参  数:HTML字符串
'返  回:
'********************************************************************************
Function RemoveHTML(strHTML)
 Dim objRegExp
 Set objRegExp = new RegExp
 objRegExp.IgnoreCase = True
 objRegExp.Global = False 
 Ftemplate = objRegExp.Replace(Ftemplate,NOBIRDArticleSEO_Code&"$1")
 Set objRegExp = Nothing
End Function
 

2.修改这些地方:

-----

aryTemplateTagsName(4)="article/intro"
  If intType=ZC_DISPLAY_MODE_SEARCH Then
   'aryTemplateTagsValue(4)=Search(TransferHTML(Intro & Content,"[html-format]"),Request.QueryString("q"))
   'aryTemplateTagsValue(4)=Search(TransferHTML(Intro & Content,"[nohtml]"),Request.QueryString("q")) 
   aryTemplateTagsValue(4)=RemoveHTML(Search(TransferHTML(Intro & Content,"[nohtml]"),Request.QueryString("q")))   
  Else
   If Level=2 Then
    aryTemplateTagsValue(4)=RemoveHTML(ZC_MSG043)
   Else
    aryTemplateTagsValue(4)=RemoveHTML(HtmlIntro)
   End If
  End If

---就是使用了RemoveHTML 这个函数,过滤htm的代码。网站的描述就很清爽了。。。

这样就不必为这个网页的描述而烦恼了。。


原创文章如转载,请注明:转载自笑话博客
原文地址:http://www.xiaohuadaba.net/blog/post/tupian/13.html