ASP Generate feed File code

Source: Internet
Author: User

<%

function Addsiteurl (ByVal Str)
If IsNull (STR) Then
Addsiteurl = ""
Exit Function
End If

Dim RE
Set re=new REGEXP
with RE
. IgnoreCase =true
. Global=true

. Pattern= "str =. replace (str, "
. Pattern= "<a" (. *?) Href= "" (?!) (HTTP|HTTPS|FTP|MMS|RSTP)://) (. *?) "" "
str =. replace (str, "<a $1href=" "" & SiteURL & $ "")
End With
Set re=nothing

Addsiteurl=str
End Function

'==================================
' Feed log Subscriptions
' Update Time: 2005-11-19
'==================================
' Read blog settings information
GetInfo (1)

' Write a keyword list
Keywords (1)

' Write emoticons
Smilies (1)

Response.Charset = "UTF-8"
Response.contenttype= "Text/xml"
Response.expires=60
Response.Write ("<?xml version=" "1.0" "encoding=" "UTF-8" "?>")
Dim cate_id,feedcate,feedtitle,memname,feedrows
Cate_id=checkstr (Request.QueryString ("Cateid"))
Feedcate=false
Feedtitle=uncheckstr (SiteName)
IF Isinteger (cate_id) = False Then
Sql= "SELECT Top L.log_id,l.log_title,l.log_author,l.log_posttime,l.log_content,l.log_edittype,c.cate_name from Blog_content as l,blog_category as C WHERE C.cate_id=l.log_cateid and L.log_isshow=true and L.log_isdraft=false and C.cate _secret=false ORDER by Log_posttime DESC "
Else
Sql= "SELECT Top L.log_id,l.log_title,l.log_author,l.log_posttime,l.log_content,l.log_edittype,c.cate_name from Blog_content as l,blog_category as C WHERE log_cateid= "&cate_ID&" and C.cate_id=l.log_cateid and l.log_isshow= True and L.log_isdraft=false and C.cate_secret=false order by Log_posttime DESC "
Feedcate=true
End IF
Dim Rs,disimg,i
Set Rs=conn.execute (SQL)
If RS. EOF or RS. BOF Then
ReDim feedrows (0,0)
Else
If Feedcate then Feedtitle=uncheckstr (SiteName & "-" & RS ("Cate_name"))
Feedrows=rs.getrows ()
End If
Rs.close
Set rs=nothing
Conn.close
Set conn=nothing
%>
<rss version= "2.0" >
<channel>
<title><! [cdata[<%=feedtitle%>]]></title>
<link><%=SiteURL%></link>
<description><! [cdata[<%=blog_title%>]]></description>
<language>zh-cn</language>
<copyright><! [Cdata[copyright PBlog2 v2.4]]></copyright>
<webmaster><! [cdata[<%=blog_email%> (<%=blog_master%>)]]></webmaster>
&LT;GENERATOR&GT;PBLOG2 v2.4</generator>
<image>
<title><%=SiteName%></title>
<url><%=SiteURL%>images/logos.gif</url>
<link><%=SiteURL%></link>
<description><%=SiteName%></description>
</image>
<%
If UBound (feedrows,1) =0 Then
Response.Write ("<item></item>")
Else
For i=0 to UBound (feedrows,2)
%>
<item>
<link><%=SiteURL& "default.asp?id=" &feedrows (0,i)%></link>
<title><! [Cdata[<%=feedrows (1,i)%>]]></title>
<author><%=blog_email%> (<%=feedrows (2,i)%>) </author>
<category><! [Cdata[<%=feedrows (6,i)%>]]></category>
<pubdate><%=datetostr (Feedrows (3,i), "W,d m y h:i:s")%></pubdate>
<guid><%=SiteURL& "default.asp?id=" &feedrows (0,i)%></guid>
<%
' IF RS (' log_isshow ') =false Then
' Response.Write ("<description><![ Cdata[This is a hidden log, please go to "&SiteName&" Home view!] ></description> ")
' Else
IF feedrows (5,i) =0 Then
Response.Write ("<description><![ cdata["&addsiteurl (Uncheckstr (Feedrows (4,i))) &"]]></description> ")
Else
Response.Write ("<description><![ cdata["&addsiteurl (Ubbcode HTMLEncode (Feedrows (4,i), 0,0,0,1,1)) &"]]></description> ")
End If
' End IF
%>
</item>
<%
Next
End If%>
</channel>
</rss>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.