<!-- #include file="../inc/301.asp" -->
<!-- #include file="../inc/conn.asp" -->
<!-- #include file="rss2.class.asp" -->
<% 
set rs=server.createobject("adodb.recordset")
sql="select web_name,web_description,web_url from Web_Setting"
rs.open(sql),conn,1,1
web_name=rs("web_name")
web_description=rs("web_description")
web_url=rs("web_url")
rs.close
set rs=nothing
%>
<%
ida=request.QueryString
id=replace(ida,".html","")
' 数据的准备: 数组
Dim arr(4, 5), i, j
for i = 0 to 4
	arr(i, 0) = "标题" & i
	arr(i, 1) = ""&url&"" & i
	arr(i, 2) = "描述" & i
	arr(i, 3) = "分类" & i
	arr(i, 4) = "作者" & i
	arr(i, 5) = now()
next
' 数据的准备: 记录集
if id<>"" then
cha="and l_id="&id&""
set rs=server.createobject("adodb.recordset")
sql="select n_id,n_name from Web_2Navigation where n_id="&id&""
rs.open(sql),conn,1,1
n_name=rs("n_name")&" - "
l_url="rss/?"&id&".html"
rs.close
set rs=nothing
end if

set rs=server.createobject("adodb.recordset")
sql="select top 10 * from web_Article where view_yes=1 "&cha&" order by w_id desc"
rs.open(sql),conn,1,1
' 创建一个Rss 2.0实例
Dim rss
set rss = new Rss2

' 显示Rss版本
'response.write( rss.Version & "<br />" )

' 设置字符编码
rss.Encoding = "GB2312"
' 设置数据源的类型, 1为数组,2为记录集,默认为记录集
rss.DataSourceType = 2

' 设置频道的属性, 参见Rss 2.0的channel标签
rss.Title = ""&n_name&""&web_name&""
rss.Link  = ""&web_url&"/"&l_url&""
rss.Description = ""&web_description&""

' 设置内容条目的属性, 参见Rss 2.0的item标签
rss.ItemTitle = 0
rss.ItemLink  = 1
rss.ItemDescription = 2
rss.ItemAuthor = 4
rss.ItemCategory = 3
rss.ItemPubDate = 5
' 如果 DataSourceType 为记录集,即2, 以下属性也可以设置为字段名, 如下:
rss.ItemTitle = "w_title"
rss.ItemLink  = ""&web_url&"/Article/?{$w_id}.html" 'ItemLink属性可以使用一个{$id}形式的变量
rss.ItemDescription = "w_description"
rss.ItemAuthor = "w_author"
rss.ItemCategory = "l_id"
'rss.ItemPubDate = "w_time"

' 绑定数据源
'rss.DataSource = arr
set rss.DataSource = rs

' 将Rss内容另存为文件, 并显示文件名
'response.write rss.SaveAs( "rss.xml" )

' 显示Rss文件
response.write rss.ToString()

set rss = nothing
rs.close
conn.close
set rs = nothing
set conn = nothing
%>