搜索文章:

首页  |  Java技术  |  Asp.net  |  Asp编程  |  VC/C++  |  Delphi  |  VB编程

使用ASP推出你自己网站的频道

想自己生成自己站点的频道文件吗,看看下面的代码把。 
这只是个例子而已,但我想你完全可以根据它来建立你自己的频道。 
以后只要用户下载该.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 
&quot;http://www.rsac.org/ratingsv01.html&quot; l gen true comment &quot;rsaci north america 
server&quot; by &quot;santry@pin-santry.com&quot; for &quot;http://yoururl.com&quot; on 
&quot;1997.09.18t17:57-0800&quot; 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 
%> 

()

相关文章:
© 2006   www.java-asp.net