以前收集的一些资料---使用ASP推出你自己网站的频道
发表于:2007-06-30来源:作者:点击数:
标签:
想自己生成自己站点的频道文件吗,看看下面的代码把。 这只是个例子而已,但我想你完全可以根据它来建立你自己的频道。 以后只要用户下载该.cdf文件,用户就能够订阅你的站点的频道了。 % ‘’打开 数据库 连接,并定义用于格式化的变量. Set DBConn = Server
想自己生成自己站点的频道文件吗,看看下面的代码把。
这只是个例子而已,但我想你完全可以根据它来建立你自己的频道。
以后只要用户
下载该.cdf文件,用户就能够订阅你的站点的频道了。
<%
‘’打开
数据库连接,并定义用于格式化的变量.
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
‘’在你网站上生成的频道文件(.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 "s
antry@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
‘’在本例子中使用数据库,下面的代码指向数据库入口。也就是你今天想要显示的文章。
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
%>
原文转自:http://www.ltesting.net