使用ASP推出你自己網(wǎng)站的頻道
發(fā)表時間:2023-08-23 來源:明輝站整理相關軟件相關文章人氣:
[摘要]想自己生成自己站點的頻道文件嗎,看看下面的代碼把。 這只是個例子而已,但我想你完全可以根據(jù)它來建立你自己的頻道。 以后只要用戶下載該.cdf文件,用戶就能夠訂閱你的站點的頻道了。 <% ...
想自己生成自己站點的頻道文件嗎,看看下面的代碼把。
這只是個例子而已,但我想你完全可以根據(jù)它來建立你自己的頻道。
以后只要用戶下載該.cdf文件,用戶就能夠訂閱你的站點的頻道了。
<%
'打開數(shù)據(jù)庫連接,并定義用于格式化的變量.
Set DBConn = Server.CreateObject("ADODB.Connection")
DBConn.Open "DSN=YourDSN"
BR = Chr(10)
Quote = Chr(34)
'用來生成頻道格式
Body = "<CHANNEL " & BR
Body = Body & "Title = " & Quote & "你的公司名" & Quote & BR
Body = Body & "LongName = " & Quote & "你的詳細公司名" & Quote & BR
Body = Body & "Abstract = " & Quote & "你的頻道說明" & Quote & BR
'在你網(wǎng)站上生成的頻道文件(.cdf)
Body = Body & "SELF = " & Quote & "http://yoururl/pointcast.cdf" & Quote & BR
Body = Body & "ContentID = " & Quote & "0" & Quote & BR
Body = Body & "Ratings = " & Quote & "'(PICS-1.1
"http://www.rsac.org/ratingsv01.html" l gen true comment "RSACi North America
Server" by "santry@pin-santry.com" for "http://yoururl.com" on
"1997.09.18T17:57-0800" r (n 0 s 0 v 0 l 0))'" & Quote & BR
Body = Body & "Frequency = " & Quote & "24" & Quote & BR
Body = Body & "Authenticate = " & Quote & "No" & Quote & BR
Body = Body & ">" & BR & BR
SQLQ = "SELECT * FROM YourDB WHERE ENTERDATE = #" & Date() & "#"
'這將把今天的新東西都推出去
Set MakeChannel = DBConn.Execute(SQLQ)
Do Until MakeChannel.Eof
Body = Body & "<ITEM " & BR
Body = Body & "Title = " & Quote & MakeChannel("Headline") & Quote & BR
'在本例子中使用數(shù)據(jù)庫,下面的代碼指向數(shù)據(jù)庫入口。也就是你今天想要顯示的文章。
Body = Body & "HREF = " & Quote & "http://yoururl/pointcast-news.asp?Article=" &
MakeChannel("FileName") & Quote & BR
Body = Body & "Type = " & Quote & "HTML" & Quote & BR
Body = Body & "Show = " & Quote & "Channel" & Quote & BR
Body = Body & "Precache = " & Quote & "Yes" & Quote & BR
Body = Body & "Authenticate = " & Quote & "No" & Quote & BR
Body = Body & ">" & BR
Body = Body & "</ITEM>" & BR & BR
MakeChannel.MoveNext
Loop
Body = Body & "</CHANNEL>"
Set fs = CreateObject("Scripting.FileSystemObject")
'生成第一個文件,每次更新時覆蓋上一個文件。
Set a = fs.CreateTextFile("d:\yourlocaldrive\pointcast.cdf", True)
a.WriteLine(Body)
a.Close
%>