<!--#include file="../lib/base.asp"-->
<!--#include file="../theme.asp"-->
<%
''' EYCMS Rss
''' ==================================================================
	eycms.stophack
	dim id:id=eycms.getint(eycms.fget("id",0),0)
	if id=0 then
		eycms.show eycms.getsys("theme_rss"),""
	else
		dim rss_01,rss_02,rss_03
		rss_01="<?xml version=""1.0"" encoding=""utf-8""?>"&vbcrlf
		rss_01=rss_01&"<rss version=""2.0"">"&vbcrlf
		rss_01=rss_01&"<channel>"&vbcrlf
		rss_01=rss_01&"<title>{classname}</title>"&vbcrlf
		rss_01=rss_01&"<link>{classurl}</link>"&vbcrlf
		rss_01=rss_01&"<description><![CDATA[{classdesc}]]></description>"&vbcrlf
		rss_01=rss_01&"<language>zh-cn</language>"&vbcrlf
		rss_01=rss_01&"<generator>Rss Generator By "&eycms_version&"</generator>"&vbcrlf
		
		rss_02="<item>"&vbcrlf
		rss_02=rss_02&"	<title>{title}</title>"&vbcrlf
		rss_02=rss_02&"	<link>{link}</link>"&vbcrlf
		rss_02=rss_02&"	<description><![CDATA[{desc}]]></description>"&vbcrlf
		rss_02=rss_02&"	<pubDate><![CDATA[{date}]]></pubDate>"&vbcrlf
		rss_02=rss_02&"	<category><![CDATA[{catename}]]></category>"&vbcrlf
		rss_02=rss_02&"</item>"&vbcrlf
		
		rss_03="</channel>"&vbcrlf
		rss_03=rss_03&"</rss>"
		
		dim t1:t1=eycms.getclassdb(id)
		if not isarray(t1) then
		
		else
			dim classname:classname=t1(1)
			dim classurl:classurl=eycms.get_cateurl(id,t1(2),t1(10),t1(9))
			dim classdesc:classdesc=t1(18)
			dim sonid:sonid=t1(5)
			dim str
			rss_01=replace(rss_01,"{classname}",classname)
			rss_01=replace(rss_01,"{classurl}",weburl&classurl)
			if eycms.strlen(classdesc)>0 then
				rss_01=replace(rss_01,"{classdesc}",classdesc)
			else
				rss_01=replace(rss_01,"{classdesc}","")
			end if
			str=rss_01
			dim data,content
			data=eycms.db.dbload(20,"id,isurl,url,catedir,title,createdate,catename,intro,classid","ey_content left join ey_category on ey_content.classid=ey_category.cateid","ey_content.islock=1 and classid in("&sonid&")","ontop desc,id desc")
			if ubound(data)>=0 then
				dim i,s
				for i=0 to ubound(data,2)
					s=rss_02
					s=replace(s,"{title}",data(4,i))
					if data(1,i)=0 then
						s=replace(s,"{link}",weburl&eycms.geturl(data(0,i),data(8,i),data(1,i),data(2,i)))
					else
						s=replace(s,"{link}",data(2,i))
					end if
					s=replace(s,"{date}",data(5,i))
					s=replace(s,"{catename}",data(6,i))
					content=data(7,i)
					if eycms.strlen(content)>0 then
						content=eycms.dehtml(content)
						s=replace(s,"{desc}",content)
					else
						s=replace(s,"{desc}","")
					end if
					str=str&s
				next
			end if
			str=str&rss_03
			Response.AddHeader "Content-Type","text/xml"
			eycms.echo str
		end if
	end if
%>
