濮阳杆衣贸易有限公司

主頁 > 知識庫 > Asp生成RSS的類_給網站加上RSS第1/2頁

Asp生成RSS的類_給網站加上RSS第1/2頁

熱門標簽:外呼系統(tǒng)怎么話費 無營業(yè)執(zhí)照地圖標注教學 宿州防封外呼系統(tǒng)平臺 友邦互聯(lián)電銷機器人違法嗎 硅基電話機器人加盟 電銷機器人采購 滴滴地圖標注上車點 高質量的電銷外呼系統(tǒng) 地圖標注還可以做嗎

什么是RSS?
RSS是站點用來和其他站點之間共享內容的一種簡易方式(也叫聚合內容),通常被用于新聞和其他按順序排列的網站,例如Blog。一段項目的介紹可能包含新聞的全部介紹等?;蛘邇H僅是額外的內容或者簡短的介紹。這些項目的鏈接通常都能鏈接到全部的內容。網絡用戶可以在客戶端借助于支持RSS的新聞聚合軟件(如FeedDemon、SharpReader,NewzCrawler),在不打開網站內容頁面的情況下閱讀支持RSS輸出的網站內容。網站提供RSS輸出,有利于讓用戶發(fā)現(xiàn)網站內容的更新。

RSS如何工作?
首先您一般需要下載和安裝一個RSS新聞閱讀器,然后從網站提供的聚合新聞目錄列表中訂閱您感興趣的新聞欄目的內容。訂閱后,您將會及時獲得所訂閱新聞頻道的最新內容。

閱讀RSS新聞的特點?
1.沒有廣告或者圖片來影響標題或者文章概要的閱讀。
2.RSS閱讀器自動更新你定制的網站內容,保持新聞的及時性。
3.用戶可以加入多個定制的RSS提要,從多個來源搜集新聞整合 到單個數(shù)據(jù)流中。


隨著網絡的普及,越來越多的人習慣通過網絡來獲取信息、查詢資料。雖然各種各樣的門戶網站紛紛興起,但在各個網站之間來回穿梭也的確是十分麻煩,搜索引擎可以幫助我們搜索到任何想要找的東西,但查找起來也比較麻煩?,F(xiàn)在網絡上出現(xiàn)了一種全新的資訊方式,他可以把我們定閱的各種資訊送到我們的桌面上來,不但可以及時了解最新的新聞資訊,而且免去了瀏覽網站時惱人的網絡廣告,這種最新的資訊方式被叫做信息聚合,簡稱RSS。
通過RSS技術,我們可以把定閱的最新的資訊接收到電腦桌面上,要接收RSS信息,使用RSS閱讀器是最好的方法。當網站內容更新時,RSS閱讀器就會自動接收,把最新的信息接收到本地電腦桌面上來,同時可以看到最新信息的標題與摘要,點擊標題就能夠查看全文內容了。自從去年國內“博客”的興起,使的RSS資源漸漸多了起來,同時各大網站也紛紛推出了RSS服務,通常只要看到網站上有XML標志,就說明該網站提供RSS服務。
FeedDemon、看天下網絡資訊瀏覽器 、新浪點點通閱讀器、周博通等是常見的RSS閱讀器。

復制代碼 代碼如下:

%
Dim Rs,Newrss
Class Rss
'*******************輸入?yún)?shù)********************
'***********************************************
'SetConn 必填 網站使用的Connection對象
'SetSql 必填 Sql查詢語句。強烈建議使用在Sql語句中使用Top關鍵字
' Sql語句中包含的字段[新聞Id,標題,內容,時間,靜態(tài)頁名稱]
' 注:不要顛倒順序
' 如果新聞不是生成的靜態(tài)頁,則無最后一項,SetPageType的值則為1
'SetWebName 必填 網站名稱
'SetWebUrl 必填 網站的地址
'SetWebDes 非必填 網站的描述信息
'SetPageType 必填 信息顯示頁的鏈接類型 1 為動態(tài)頁面Id 0為靜態(tài)頁面
'SetMaxInfo 非必填 強制顯示信息的數(shù)目,若取數(shù)據(jù)>SetMaxInfo 則顯示SetMaxInfo條數(shù)據(jù)。強烈建議使用在Sql語句中使用Top關鍵字
'setContentShow 非必填 信息簡介設置。注意:該參數(shù)為數(shù)組(ShowContentType,ShowContentLen)
' ShowContentType [數(shù)字類型] 為內容顯示方式[參數(shù)(0,1)0為按百分比就算顯示信息,1為按字數(shù)]
' ShowContentLen 內容顯示的長度 由ShowContentType 決定實際長度
'*****************輸出參數(shù)********************
'ShowRss 顯示Rss
'======================================================
'例如
'Set NewRss=New Rss
' Set NewRss.SetConn=article_conn
' NewRss.SetSql="select top 30 newsid,title,content,dateandtime,N_fname from article where typeid=1 order by newsid Desc"
' NewRss.SetWebName="測試中"
' NewRss.SetWebUrl="https://www.jb51.net"
' NewRss.SetMaxInfo=10
' NewRss.SetInfourl="https://www.jb51.net"
' NewRss.SetPageType="0"
' NewRss.setContentShow="1,200"
' NewRss.ShowRss()
'Set NewRss=Nothing
'======================================================
Private Conn,Sql,WebName,WebUrl,WebDes,Er,MaxInfo,i,Infourl,PageType
Private ShowContentType,ShowContentLen
Private AllContent,AllContentLen
Private Sub Class_initialize()
MaxInfo=20
'PageType=1
ShowContentType=0
ShowContentLen=20
Er=false
End Sub
Private Sub Class_terminate()
If isObject(Rs) then Set Rs=Nothing
End Sub
Public Property Let Errmsg(msg)
If Er then
Response.Clear()
Response.Write(msg)
Response.End()
End If
End Property
Public Property Let SetWebName(WebName_)
WebName=WebName_
End Property
Public Property Let SetWebUrl(WebUrl_)
WebUrl=WebUrl_
End Property
Public Property Let SetWebDes(webDes_)
WebDes=WebDes_
End Property
Public Property Let SetInfoUrl(Infourl_)
Infourl=Infourl_
End Property
Public Property Let SetPageType(PageType_)
PageType=PageType_
End Property
Public Property Let SetMaxInfo(MaxInfo_)
MaxInfo=MaxInfo_
End Property
Public Property Let setContentShow(ContentShow_)
Dim ArrContentShow
ArrContentShow=Split(ContentShow_,",")
If Ubound(ArrContentShow)>1 Then Er=True:Errmsg="信息顯示參數(shù)設置有誤!!"
ShowContentType=ArrContentShow(0)
ShowContentLen=ArrContentShow(1)
If Not isnumeric(ShowContentType) or ShowContentType="" Then ShowContentType=0
If Not isnumeric(ShowContentLen) or ShowContentLen="" Then
If ShowContentType=0 Then ShowContentLen=20 Else ShowContentLen=200
Else
If ShowContentType=0 and (ShowContentLen>100 or ShowContentLen10) Then ShowContentLen=20
End If
End Property
Public Property Set SetConn(Conn_)
If TypeName(Conn_)="Connection" Then
Set Conn=Conn_
Else
Er=true
Errmsg="數(shù)據(jù)庫連接錯誤"
Exit property
End If
End Property
Public Property Let SetSql(sql_)
Sql=Sql_
End Property
Public Property Get RssHead()
RssHead="?xml version=""1.0"" encoding=""gb2312"" ?> "
RssHead=RssHead"rss>"
RssHead=RssHead"channel>"
RssHead=RssHead"title>"WebName"/title>"
RssHead=RssHead"link>"WebUrl"/link>"
RssHead=RssHead"description>"WebDes"/description>"
End Property
Private Property Get RssBottom()
RssBottom="/channel>"
RssBottom=RssBottom"/rss>"
End Property
Public Sub ShowRss()
On Error resume Next
Dim Rs
Dim ShowInfoUrl,ShowContent,Content
If TypeName(Conn)>"Connection" Then Er=True:Errmsg="Connection對象有誤"
If Sql="" or isnull(Sql)="" or isempty(Sql)="" Then Er=True:Errmsg="沒有可執(zhí)行的Sql語句"
If WebName="" or isnull(WebName)="" or isempty(WebName)="" Then Er=True:Errmsg="請設置RSS標題"
If WebUrl="" or isnull(WebUrl)="" or isempty(WebUrl)="" Then Er=True:Errmsg="請設置網站的鏈接"
If InfoUrl="" or isnull(InfoUrl)="" or isempty(InfoUrl)="" Then Er=True:Errmsg="請設置鏈接信息"
If PageType="" or isnull(PageType)="" or isempty(PageType)="" Then Er=True:Errmsg="請設置鏈接類型"
Set Rs=Server.CreateObject("ADODB.RecordSet")
Rs.Open Sql,Conn,1,1
If Err Then
Er=true
Errmsg="數(shù)據(jù)庫未能打開br />請檢查您的Sql語句是否正確"
Exit Sub
End If

Response.Charset = "gb2312"
Response.ContentType="text/xml"
Response.Write(RssHead)
For i =1 to MaxInfo
'*****************************
ShowInfoUrl=InfoUrl
If ShowInfoUrl="" or isnull(ShowInfoUrl) or isempty(ShowInfoUrl) Then
ShowInfoUrl="#"
Else
If PageType Then ShowInfoUrl=ShowInfoUrlRs(0) Else ShowInfoUrl=ShowInfoUrlRs(4)
End If
'*****************************
AllContent=LoseHtml(Rs(2))
AllContentLen=byteLen(AllContent)
ShowContent=int(ShowContentLen)
If ShowContentType=0 Then ShowContent=AllContentLen*ShowContent/100
Content=Server.HTMLEncode(titleb(AllContent,ShowContent))
Response.Write("item>")
Response.Write("title>")
Response.Write(Rs(1))
Response.Write("/title>")
Response.Write("link>")
Response.Write(ShowInfoUrl)
Response.Write("/link>")
Response.Write("description>")
Response.Write(Content)
Response.Write("/description>")
Response.Write("pubDate>")
Response.Write(return_RFC822_Date(Rs(3),"GMT"))
Response.Write("/pubDate>")
Response.Write("/item>")
If Rs.Eof or i>cint(MaxInfo) Then Exit For
Rs.MoveNext
Next
Response.Write(RssBottom)
End Sub
Function LoseHtml(ContentStr)
Dim ClsTempLoseStr,regEx
ClsTempLoseStr = Cstr(ContentStr)
Set regEx = New RegExp
regEx.Pattern = "\/*[^>]*>"
regEx.IgnoreCase = True
regEx.Global = True
ClsTempLoseStr = regEx.Replace(ClsTempLoseStr,"")
LoseHtml = ClsTempLoseStr
End function
Function return_RFC822_Date(byVal myDate, byVal TimeZone)
Dim myDay, myDays, myMonth, myYear
Dim myHours, myMinutes, mySeconds

myDate = CDate(myDate)
myDay = EnWeekDayName(myDate)
myDays = Right("00" Day(myDate),2)
myMonth = EnMonthName(myDate)
myYear = Year(myDate)
myHours = Right("00" Hour(myDate),2)
myMinutes = Right("00" Minute(myDate),2)
mySeconds = Right("00" Second(myDate),2)


return_RFC822_Date = myDay", " _
myDays" " _
myMonth" " _
myYear" " _
myHours":" _
myMinutes":" _
mySeconds" " _
" " TimeZone
End Function
Function EnWeekDayName(InputDate)
Dim Result
Select Case WeekDay(InputDate,1)
Case 1:Result="Sun"
Case 2:Result="Mon"
Case 3:Result="Tue"
Case 4:Result="Wed"
Case 5:Result="Thu"
Case 6:Result="Fri"
Case 7:Result="Sat"
End Select
EnWeekDayName = Result
End Function
Function EnMonthName(InputDate)
Dim Result
Select Case Month(InputDate)
Case 1:Result="Jan"
Case 2:Result="Feb"
Case 3:Result="Mar"
Case 4:Result="Apr"
Case 5:Result="May"
Case 6:Result="Jun"
Case 7:Result="Jul"
Case 8:Result="Aug"
Case 9:Result="Sep"
Case 10:Result="Oct"
Case 11:Result="Nov"
Case 12:Result="Dec"
End Select
EnMonthName = Result
End Function
function titleb(str,strlen)
Dim Bstrlen
bstrlen=strlen
If isempty(str) or isnull(str) or str="" Then
titleb=str
exit function
Else
dim l,t,c,i
l=len(str)
t=0

for i=1 to l
c=Abs(Asc(Mid(str,i,1)))
if c>255 then
t=t+2
else
t=t+1
end if

if t>=bstrlen then
titleb=left(str,i)
exit for
else
titleb=str""
end if
next
End If
end function
function byteLen(str)
dim lenStr,lenTemp,i
lenStr=0
lenTemp=len(str)
dim strTemp
for i=1 to lenTemp
strTemp=asc(mid(str,i,1))
if strTemp>255 or strTemp=0 then
lenStr=lenStr+2
else
lenStr=lenStr+1
end if
next
byteLen=lenStr
end function
End Class
%>

12下一頁閱讀全文

標簽:新余 廣元 宣城 七臺河 錫林郭勒盟 儋州 雅安 江門

巨人網絡通訊聲明:本文標題《Asp生成RSS的類_給網站加上RSS第1/2頁》,本文關鍵詞  Asp,生成,RSS,的類,給,網站,;如發(fā)現(xiàn)本文內容存在版權問題,煩請?zhí)峁┫嚓P信息告之我們,我們將及時溝通與處理。本站內容系統(tǒng)采集于網絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《Asp生成RSS的類_給網站加上RSS第1/2頁》相關的同類信息!
  • 本頁收集關于Asp生成RSS的類_給網站加上RSS第1/2頁的相關信息資訊供網民參考!
  • 推薦文章
    镇原县| 朔州市| 盐山县| 江油市| 正蓝旗| 冕宁县| 南漳县| 信宜市| 溧阳市| 香河县| 铅山县| 贞丰县| 寻乌县| 福泉市| 巨鹿县| 二连浩特市| 昭苏县| 淮安市| 巴南区| 昌江| 洮南市| 颍上县| 沂源县| 阳山县| 申扎县| 莲花县| 磴口县| 闽侯县| 珲春市| 岳普湖县| 邳州市| 集贤县| 西乌| 南丹县| 天峻县| 昌宁县| 平舆县| 江川县| 上蔡县| 康保县| 枝江市|