FoosunCMS-新闻列表读取内容时去掉html代码
来自站长百科
导航:返回上一页
FoosunCMS-新闻列表读取内容时去掉html代码 具体修改如下:
读取列表新闻内容去掉图片及html代码 第一步:修改fs_inc/function.asp 191行返回中文字符的前StrLen位字符 By Wen Yongzhong 前面加入
内容格式化
Function filt_html_b(fString)
If Not IsNull(fString) Then
fString = Replace(fString, " ", "")
fString = Replace(fString, CHR(32), "")
fString = Replace(fString, CHR(9), "")
fString = Replace(fString, CHR(13), "")
fString = Replace(fString, CHR(10), "")
filt_html_b = fString
End If
End Function
Function RemoveHTML(strHTML)
strHTML=filt_html_b(strHTML)
ON ERROR RESUME NEXT
Dim objRegExp, strOutput
Set objRegExp = New Regexp
objRegExp.IgnoreCase = True
objRegExp.Global = True
objRegExp.Pattern = "<.+?>"
strOutput = objRegExp.Replace(strHTML, "")
strOutput = Replace(strOutput, "<", "<")
strOutput = Replace(strOutput, ">", ">")
RemoveHTML = strOutput
Set objRegExp = Nothing
End Function
格式化结速
第二步:
修改FS_InterFace/Ns_public.asp
大概if instr(s_Content,"{NS:FS_Content}")>0 then 2157行
把' s_Content = replace(s_Content,"{NS:FS_Content}",
replace(replace(GetCStrLen(""&replace(""&f_obj("Content"),"
","")&"",f_contentnumber)," ",""),vbCrLf,"")&"...
<a href="""& s_NewsPathUrl &""">详细内容</a>")
改为
修改列表内容开始,过滤调用列表内容时的http代码(www.nn.cn)
dim navinumnn1
navinumnn1=RemoveHTML(f_obj("Content"))
s_Content = replace(s_Content,"{NS:FS_Content}",
replace(replace(GetCStrLen(""&replace(""&navinumnn1,"
","")&"",f_contentnumber)," ",""),vbCrLf,"")&"...
<a href="""& s_NewsPathUrl &""">阅读全文</a>")
修改列表内容导读结束