<!--#include file="../inc/conn.asp"-->
<%
'============================================================
'插件名称：RSS
'Website：http://www.sdcms.cn
'Author：sdcms.cn
'Date：2008-2-25
'============================================================
Response.Clear
Response.CharSet="gb2312"  '数据集
Response.ContentType="text/xml"  '数据流格式定义
set sdcms_f=new sdcms_function
	id=sdcms_f.Requestint(id)
	set rs_class=conn.execute("select allclassid from sd_class where id="&id&"")
	if rs_class.eof then
		echo Get_allrss
	else
		echo get_rss(id,rs_class(0))
	end if
set sdcms_f=nothing

Function Get_rss(t0,t1)
	t2=""
	t2=t2&"<?xml version=""1.0"" encoding=""gb2312""?>"& vbcrlf
	t2=t2&"<rss version=""2.0"">"& vbcrlf
	t2=t2&"<channel>"& vbcrlf
	set rs=conn.execute("select title,classdir,class_desc from sd_class where id="&id&"")
	if not rs.eof then
	t2=t2&"<title><![CDATA["&rs(0)&"]]></title>"& vbcrlf
	t2=t2&"<link><![CDATA["&sdcms_weburl&sdcms_root&rs(1)&"]]></link>"& vbcrlf
	t2=t2&"<description><![CDATA["&rs(2)&"]]></description>"& vbcrlf
	t2=t2&"<language>zh-cn</language>"& vbcrlf
	t2=t2&"<generator>Rss Generator By SDCMS.CN</generator>"& vbcrlf
	end if
	set rs=conn.execute("select top 100 title,classid,jj,lastupdate,author,htmlname from sd_info where classid in("&t1&") order by lastupdate desc")
	
	while not rs.eof
	t2=t2&"<item>"& vbcrlf
	t2=t2&"    <title><![CDATA["&rs(0)&"]]></title>"& vbcrlf
	t2=t2&"    <link><![CDATA["&sdcms_weburl&sdcms_root&sdcms_f.loadrecord("classdir","sd_class",rs(1))&rs(5)&sdcms_filetxt&"]]></link>"& vbcrlf
	t2=t2&"    <description><![CDATA["&rs(2)&"]]></description>"& vbcrlf
	t2=t2&"    <pubDate><![CDATA["&sdcms_f.sdcms_date(rs(3),1)&"]]></pubDate>"& vbcrlf
	t2=t2&"    <category><![CDATA["&sdcms_f.loadrecord("title","sd_class",rs(1))&"]]></category>"& vbcrlf
	t2=t2&"    <author><![CDATA["&rs(4)&"]]></author>"& vbcrlf
	t2=t2&"</item>"& vbcrlf
	rs.movenext
	wend
	t2=t2&"</channel>"& vbcrlf
	t2=t2&"</rss>"& vbcrlf
	Get_rss=t2
End Function

Function Get_allrss
	t1=""
	t1=t1&"<?xml version=""1.0"" encoding=""gb2312""?>"& vbcrlf
	t1=t1&"<rss version=""2.0"">"& vbcrlf
	t1=t1&"<channel>"& vbcrlf

	t1=t1&"<title><![CDATA["&sdcms_webname&"]]></title>"& vbcrlf
	t1=t1&"<link><![CDATA["&sdcms_weburl&sdcms_root&"]]></link>"& vbcrlf
	t1=t1&"<description><![CDATA["&sdcms_f.loadrecord("webdec","sd_const",1)&"]]></description>"& vbcrlf
	t1=t1&"<language>zh-cn</language>"& vbcrlf
	t1=t1&"<generator>Rss Generator By SDCMS.CN</generator>"& vbcrlf

	set rs=conn.execute("select  title,classdir,class_desc,id from sd_class order by id desc")
	while not rs.eof
	t1=t1&"<item>"& vbcrlf
	t1=t1&"    <title><![CDATA["&rs(0)&"]]></title>"& vbcrlf
	t1=t1&"    <link><![CDATA[?id="&rs(3)&"]]></link>"& vbcrlf
	t1=t1&"    <description><![CDATA["&rs(2)&"]]></description>"& vbcrlf
	t1=t1&"</item>"& vbcrlf
	rs.movenext
	wend
	t1=t1&"</channel>"& vbcrlf
	t1=t1&"</rss>"& vbcrlf
	Get_allrss=t1
End Function
%>