页面关键字标签及采集新闻自动添加关键字
【IT168 技术文章】为了方便搜索引擎,所以仿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