3.1-页面关键字标签及采集新闻手动添加关键字_风讯Cms教程
优采云 发布时间: 2020-08-10 19:02本文讨论区:
为了便捷搜索引擎,所以仿NB的文章系统制做下页面要害字的标签! 第一步 在 foosun\Admin\Refresh\Function.asp 找到 Function GetNewsContent(TempletContent,NewsRecordSet,NewsContent)
TempletContent = Replace(TempletContent,"{News_Title}",NewsRecordSet("Title")) 在下边添上 '要害字标签
if Not IsNull(NewsRecordSet("keywords")) then
TempletContent = Replace(TempletContent,"{News_keywords}",NewsRecordSet("keywords"))
else
TempletContent = Replace(TempletContent,"{News_keywords}","")
end if
'要害字标签 在最后倒数第二行,也就是 %>的后面,添上
'************************************
'author:lino
'把标题与要害字表中的记录匹配
'Start
'*************************
Function replaceKeywordByTitle(title)
Dim whereisKeyword,i,theKeywordOnNews
Dim keyword,rsRuleObj,theKeywordS '***如果你用3.0版,请把下行fs_Routine改成Routine
Set RsRuleObj = Conn.Execute("Select * from FS_Routine")
do while Not RsRuleObj.Eof
keyword = RsRuleObj("name")
whereisKeyword = InStr(Lcase(title),Lcase(keyword))
if(whereisKeyword>0) then
if(theKeywordOnNews="") then
theKeywordOnNews=keyword
else
theKeywordOnNews=theKeywordOnNews&""&keyword
end if
end if
RsRuleObj.MoveNext
loop '假如keyword的厚度小于100,截去过长的
if(len(theKeywordOnNews)>99) then
theKeywordOnNews=left(theKeywordOnNews,99)
end if replaceKeywordByTitle = theKeywordOnNews
End function
'**********************
'End 第二步 在 foosun/funpages/ lablenews.asp 找到 选择插入数组 在下边添上 '页面要害字标签
页面要害字
'页面要害字标签
第三步师在foosun/admin/info/newswords.asp 中 大约306行左右 找到
INewsAddObj("KeyWords") = Replace(Replace(Request("KeywordText"),"""",""),"'","")
将这句更改为
'************************************
'author:lino
'把调用replaceKeywordByTitle方式,过滤要害字
'假如用户自定义了要害字,自动设置要害字不起作用
'Start
'*************************
Dim KeywordText
if (Request("KeywordText")="" or isempty(Request("KeywordText"))) then
KeywordText = replaceKeywordByTitle(ITitle) else
KeywordText = Request("KeywordText")
end if if KeywordText "" then
INewsAddObj("KeyWords") = Replace(Replace(KeywordText,"""",""),"'","")
end if 'End
'*********************************** 第四步 在 Foosun/Admin/Collect/movenewstosystem.asp 中 大约117行,找到
RsSysNewsObj("TxtSource") = RsNewsObj("Source") 将之更改为
RsSysNewsObj("keywords") =replaceKeywordByTitle(RsNewsObj("title"))
程序改动OK! 下面制做标签, 可以在 自定义标签 的 新闻浏览 里,自己选择 页面要害字 标签