3.1-页面关键字标签及采集新闻自动添加关键字-风讯CMS教程
来源:模板无忧 作者:风讯科技
更新时间:2006-06-16
点击:
本文讨论区: http://bbs.foosun.net/dispbbs.asp?BoardID=22&replyID=81152&id=16688&skin=0
为了方便搜索引擎,所以仿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 找到 <option selected>选择插入字段</option> 在下面添上 '页面要害字标签
<option value=\"{News_keywords}\">页面要害字</option>
'页面要害字标签
第三步师在 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! 下面制作标签, 可以在 自定义标签 的 新闻浏览 里,自己选择 页面要害字 标签
相关风讯CMS教程:
最新评论:
评论加载中....
发表评论:不能超过250字节,请自觉遵守互联网相关政策法规.
- 昵称: 验证:







