插入关键字 文章采集器(把标题与关键字表中的记录匹配匹配的标签!)

优采云 发布时间: 2021-09-06 15:14

  插入关键字 文章采集器(把标题与关键字表中的记录匹配匹配的标签!)

  【IT168 Technology文章】为了方便搜索引擎,所以模仿NB的文章系统制作下一页标签的关键词

  第一步

  在 foosun\Admin\Refresh\Function.asp 中找到

  函数 GetNewsContent(TempletContent,NewsRecordSet,NewsContent)

  TempletContent = Replace(TempletContent,"{News_Title}",NewsRecordSet("Title"))

  在下面添加

  '关键字标签

  如果不是 IsNull(NewsRecordSet("keywords")) 那么

  TempletContent = Replace(TempletContent,"{News_keywords}",NewsRecordSet("keywords"))

  其他

  TempletContent = Replace(TempletContent,"{News_keywords}","")

  如果结束

  '关键字标签

  在最后的倒数第二行,即%>之前,添加

  '****************************************

  '作者:lino

  '将标题与关键字表中的记录匹配

  '开始

  '********************************

  函数replaceKeywordByTitle(title)

  暗淡 whereisKeyword,i,theKeywordOnNews

  Dim 关键字,rsRuleObj,theKeywordS

  '***如果使用3.0版本,请将下游的fs_Routine改为Routine

  Set RsRuleObj = Conn.Execute("Select * from FS_Routine")

  做而不是 RsRuleObj.Eof

  keyword = RsRuleObj("name")

  whereisKeyword = InStr(Lcase(title),Lcase(keyword))

  if(whereisKeyword>0) then

  if(theKeywordOnNews="") 那么

  theKeywordOnNews=关键字

  其他

  theKeywordOnNews=theKeywordOnNews&""&keyword

  如果结束

  如果结束

  RsRuleObj.MoveNext

  循环

  '如果关键字长度大于100,剪掉太长的

  if(len(theKeywordOnNews)>99) then

  theKeywordOnNews=left(theKeywordOnNews,99)

  如果结束

  replaceKeywordByTitle = theKeywordOnNews

  结束函数

  '************************

  '结束

  第二步

  在 foosun/funpages/lablenews.asp

  查找选择插入字段

  在下面添加

  '页面关键字标签

  页面关键字

  '页面关键字标签

  第三步

  在 foosun/admin/info/newswords.asp 中找到大约 306 行

  INewsAddObj("KeyWords") = Replace(Replace(Request("KeywordText"),"""",""),"'","")

  把这句话改成

  '****************************************

  '作者:lino

  '调用replaceKeywordByTitle方法过滤关键字

  '如果用户自定义了关键字,自动设置关键字将不起作用

  '开始

  '********************************

  暗淡的关键字文本

  if (Request("KeywordText")="" or isempty(Request("KeywordText"))) then

  KeywordText = replaceKeywordByTitle(ITtitle)

  其他

  KeywordText = Request("KeywordText")

  如果结束

  if KeywordText "" then

  INewsAddObj("KeyWords") = Replace(Replace(KeywordText,"""",""),"'","")

  如果结束

  '结束

  '****************************************

  第四步

  在Foosun/Admin/Collect/movenewstosystem.asp大约117行,找到

  RsSysNewsObj("TxtSource") = RsNewsObj("Source")

  修改为

  RsSysNewsObj("keywords") =replaceKeywordByTitle(RsNewsObj("title"))

  程序更改OK!

  制作下面的标签,您可以在自定义标签的新闻浏览中选择页面的关键字标签。

  具体标签如下{News_keywords},写在新闻模板的title或meta centent中,方便搜索引擎收录!

0 个评论

要回复文章请先登录注册


官方客服QQ群

微信人工客服

QQ人工客服


线