首页 | 风讯安装 | 后台管理 | 升级转换 | 模板制作 | 标签说明 | 采集说明 | 常见问题 | 自由标签 | 样式管理 | 功能扩展 | 插件使用 |
常 见 问 题
新 手 入 门
中 级 进 阶
高 级 技 巧
 3.1-页面关键字标签及采集新闻自动添加关键字 ★★★★★ 【字体:小 大】 
3.1-页面关键字标签及采集新闻自动添加关键字
http://www.foosun.cn   作者:风讯科技   来源:  点击:  更新时间:06-06-16 11:42:08
 

本文讨论区: 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 内,方便搜索引擎收录!
9 7 3 1 2 4 8 :
文章录入:风讯科技  责任编辑:风讯科技  
·上一篇:3.1-采集教程(1例)
·下一篇:新浪新闻采集,广告、多余代码全过虑设置方法!
【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
 网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)
 没有任何评论
2002-2006 Foosun Inc. 四川风讯科技发展有限公司.版权所有  蜀ICP备 05005237