<!-- #include file="../Include/Channel_Blog.asp" -->
<!-- #Include file="Common.asp" -->
<%
Dim tmp_url,tmp_urls,tmp_title,C_ID,tmp_sql,tmp_sql_order
Call Channel_Load(0)
'----------------------------中间 开始----------------------------
Call Rss_First()
Call Rss_Head()
   If Not Cls.RssTrue Then
      Call Rss_Error("该频道不支持RSS功能！")
   else
      Call Rss_Main()
   end if
Call Rss_End()
'----------------------------中间 结束----------------------------
Call Channel_end(0)

sub Rss_Error(errstr)
  response.write vbcrlf&vbcrlf&"<item>" & _
          vbcrlf&"<title><![CDATA[错误提示信息："&errstr&"]]></title>" & _
          vbcrlf&"<link><![CDATA["&tmp_urls&"]]></link>" & _
          vbcrlf&"<author><![CDATA["&tmp_title&"]]></author>" & _
          vbcrlf&"<pubDate>"&Cls.now_time&"</pubDate>" & _
          vbcrlf&"</item>"
end sub

sub Rss_First()
 C_ID=Cls.Code_ID("c_id")
  Select Case action
  Case "hot"
	tmp_sql="and counter>20"
    tmp_sql_order="counter desc"
	tmp_title="热门"&Cls.ChannelTit
	tmp_url=Cls.web_urls&Index_Url&"RssFeed.asp?action=hot"
    tmp_urls=Cls.web_urls&Index_Url&"List1.asp?action=hot"
  Case "pic"
    tmp_sql=" And ispic=1"
	tmp_sql_order="istop desc,id desc"
	tmp_title="图片"&Cls.ChannelTit
	tmp_url=Cls.web_urls&Index_Url&"RssFeed.asp?action=pic"
    tmp_urls=Cls.web_urls&Index_Url&"List2.asp?action=pic"
  Case "good"
    tmp_sql=" And isgood=1"
	tmp_sql_order="istop desc,id desc"
	tmp_title="推荐"&Cls.ChannelTit
	tmp_url=Cls.web_urls&Index_Url&"RssFeed.asp?action=good"
    tmp_urls=Cls.web_urls&Index_Url&"List.asp?action=good"
  Case "focus"
    tmp_sql=" And isfocus=1"
	tmp_sql_order="istop desc,id desc"
	tmp_title="焦点"&Cls.ChannelTit
	tmp_url=Cls.web_urls&Index_Url&"RssFeed.asp?action=focus"
    tmp_urls=Cls.web_urls&Index_Url&"List.asp?action=focus"
  Case else
    if int(C_ID)>0 then
    'tmp_sql=" And ClassID="&C_ID
    tmp_sql=" And ClassID in ("&Class_Cid_Get(C_ID)&")"
	tmp_sql_order="id desc"
	tmp_title=Cls.ChannelTit&" - "&Class_Grade_Xml(C_ID,Cls.ClassDepth)&"相关信息"
	tmp_url=Cls.web_urls&Index_Url&"RssFeed.asp?c_id="&C_ID
    tmp_urls=Cls.web_urls&Index_Url&"List.asp?c_id="&C_ID
end if
  End Select
end sub

sub Rss_Main()
  Dim tmp_topic,tmp_urle,content
  sql="select top 20 "&Cls.ChannelRssField&",content from "&Cls.ChannelTable&" where hidden=1 "&tmp_sql&" order by id desc"
  set rs=Cls.exec(sql,1)
	If Rs.Eof Then
	Rs.Close
        Call Rss_Error("该频道不存在或频道下无内容！")
		Exit Sub
	End If
  do while not rs.eof
    content=rs("content")
    content=RemoveHTML(content)
    content=left(content,220)
    content=Cls.Code_word(content)
    tmp_topic=Cls.code_word(rs(1))
	tmp_urle=Index_Url&"?"&rs(2)
    response.write vbcrlf&vbcrlf&"<item>" & _
          vbcrlf&"<title><![CDATA["&tmp_topic&"]]></title>" & _
          vbcrlf&"<description><![CDATA["&content&"...]]></description>" & _
          vbcrlf&"<link><![CDATA["&Cls.web_urls&tmp_urle&"]]></link>" & _
          vbcrlf&"<author><![CDATA["&rs(2)&"]]></author>" & _
          vbcrlf&"<pubDate>"&rs(3)&"</pubDate>" & _
          vbcrlf&"</item>"
    rs.movenext
  loop
  rs.close
end sub

sub Rss_Head()
  response.clear
  response.ContentType="text/xml"
  response.write "<?xml version=""1.0"" encoding=""gb2312""?>" & _
        vbcrlf&"<?xml-stylesheet type=""text/xsl"" href="""&Cls.Web_Dir&"style/rss.xsl"" version=""1.0""?>" & _
        vbcrlf&"<rss version=""2.0"">" & _
        vbcrlf&"<channel>" & _
        vbcrlf&"<title>"&Cls.web_name&" - "&tmp_title&"</title>" & _
        vbcrlf&"<description>"&Cls.web_name&"</description>" & _
        vbcrlf&"<link>"&tmp_urls&"</link>" & _
        vbcrlf&"<language>zh-cn</language>" & _
        vbcrlf&"<Currentlink><![CDATA["&tmp_url&"]]></Currentlink>" & _
        vbcrlf&"<docs>"&Cls.web_name&"</docs>" & _
        vbcrlf&"<generator>"&Cls.web_name&"</generator>" & _
        vbcrlf&"<image>" & _
        vbcrlf&"  <title><![CDATA["&Cls.web_name&"]]></title>" & _
        vbcrlf&"  <url>"&Cls.Web_Dir&"images/logo.gif</url>" & _
        vbcrlf&"  <link>"&Cls.Web_Dir&"</link>" & _
        vbcrlf&"</image>"
end sub

sub Rss_End()
  response.write vbcrlf&vbcrlf&"</channel>" & _
        vbcrlf&"</rss>"&vbcrlf
end sub
%>