国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網(wǎng)站 > 建站經(jīng)驗 > 正文

添加新聞時自動添加關(guān)鍵字

2024-08-30 19:06:08
字體:
供稿:網(wǎng)友

我是先做抓取新聞時自動添加要害字后,想到手工添加新聞時也可以把這個功能用上去。所以兩段程序可以說是完全一樣的,只是應(yīng)用的場所不同~

請先備份:

Admin/Info/NewsWords.asp

下面開始修改:

1、打開Admin/Info/NewsWords.asp,拉到倒數(shù)第二行(也就是%>的前面),把下面的代碼貼上去。

'************************************
'author:lino
'把標題與要害字表中的記錄匹配
'Start
'*************************
Function replaceKeywordByTitle(title)
Dim whereisKeyword,i,theKeywordOnNews
Dim keyword,rsRuleObj,theKeywordS
Set RsRuleObj = Conn.Execute("Select * from 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

在同一頁面(即Admin/Info/NewsWords.asp)中找到

INewsAddObj("KeyWords") = Replace(Replace(Requst("KeywordText"),"""",""),"'","")
或約637行,把
INewsAddObj("KeyWords") = Replace(Replace(Requst("KeywordText"),"""",""),"'","")
換成
'************************************
'author:lino
'把調(diào)用replaceKeywordByTitle方法,過濾要害字
'假如用戶自定義了要害字,自動設(shè)置要害字不起作用

'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
'***********************************

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 蛟河市| 枣阳市| 阿城市| 读书| 太和县| 汝南县| 绥棱县| 灵丘县| 铜梁县| 盘锦市| 普格县| 青海省| 辛集市| 丹寨县| 民勤县| 横山县| 永登县| 独山县| 双牌县| 惠东县| 安义县| 灵璧县| 读书| 江津市| 分宜县| 勐海县| 呼玛县| 漳浦县| 凤山市| 翁牛特旗| 景洪市| 独山县| 交城县| 江西省| 泗洪县| 房山区| 肇庆市| 肇庆市| 玛曲县| 浮山县| 霍山县|