|
本文讨论区: 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!
下面制作标签, 可以在 自定义标签 的 新闻浏览 里,自己选择 页面关键字 标签
具体标签如下 {News_keywords} ,写在新闻模版的 title 或者 meta centent 内,方便搜索引擎收录! |