Click here to Skip to main content
Licence 
First Posted 19 Dec 2004
Views 22,740
Bookmarked 17 times

RSS feed in ASP script

By | 12 Jan 2005 | Article
Very simple RSS feed script in ASP

Introduction

very simple

edit your own SQL exec yourself in this code

by Zion,  udanax@msn.com

sample : http://localhost/xrss.asp?FeedID=ifm_id

 

<BR><?xml version="1.0" encoding="EUC-KR" ?><BR><%<BR>'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''<BR>'2004 code by udanax.msn.com<BR>'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''<BR>Dim FeedID,Conn,rs,SQL,rs2, tt, cc, rr<BR> FeedID = Request("FeedID")<BR> <BR>'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''<BR>set Conn = Server.CreateObject("ADODB.connection")<BR> Conn.Open gsInfoMailConnStr<BR>     SQL = "select top 1 b.sendpage_id, a.ifm_title, a.ifm_intro, a.ifm_id from ifm_info" <BR>     SQL += "a inner join ifm_sendpage_info b on a.ifm_id = b.ifm_id inner join ifm_sendpage_contents_info c on b.sendpage_id = c.sendpage_id" <BR>     SQL += "where a.ifm_id = '"&FeedID&"'"<BR>      <BR> set rs2 = Conn.Execute(SQL)<BR>       tt = rs2("ifm_title")<BR>       cc = rs2("ifm_intro")<BR>       rr = rs2("ifm_id")  <BR> rs2.close<BR>'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''<BR>Response.ContentType = "text/xml" <BR><BR><BR>      Set xmlPars = Server.CreateObject("Msxml2.DOMDocument")<BR>       Set rss = xmlPars.CreateElement("rss")<BR>        rss.setAttribute "version", "2.0" <BR>        rss.setAttribute "xmlns:dc", "<A href="http://purl.org/dc/elements/1.1/">http://purl.org/dc/elements/1.1/</A>" <BR>        rss.setAttribute "xmlns:sy", "<A href="http://purl.org/rss/1.0/modules/syndication/">http://purl.org/rss/1.0/modules/syndication/</A>" <BR>        rss.setAttribute "xmlns:admin", "<A href="http://webns.net/mvcb/">http://webns.net/mvcb/</A>" <BR>        rss.setAttribute "xmlns:rdf", "<A href="http://www.w3.org/1999/02/22-rdf-syntax-ns">http://www.w3.org/1999/02/22-rdf-syntax-ns</A>#" <BR>       xmlPars.AppendChild(rss)<BR>'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''channel set start@<BR>       Set Channel = xmlPars.CreateElement("channel")<BR>           rss.AppendChild(Channel)<BR>       <BR>       Set title = xmlPars.CreateElement("title")<BR>           Channel.AppendChild(title)<BR>           Channel.childnodes(0).text = tt<BR>       <BR>       Set channel_link = xmlPars.CreateElement("link")<BR>           Channel.AppendChild(channel_link)<BR>           Channel.childnodes(1).text = "<A href="http://localhost/?ifm_id">http://localhost/?ifm_id</A>=" & rr<BR>       <BR>       Set description = xmlPars.CreateElement("description")<BR>           Channel.AppendChild(description)<BR>           Channel.childnodes(2).text = cc<BR>       <BR>       Set language = "xmlPars.CreateElement(""dc:language")<BR>           Channel.AppendChild(language)<BR>           Channel.childnodes(3).text = "ko"<BR><BR>'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''db query<BR>SQL = "select top 8 b.sendpage_id, a.ifm_title, a.ifm_intro, a.ifm_id, b.sendpage_title, a.user_id, a.chat_id, c.sendpage_contents, b.regdate"  <BR>SQL += "from ifm_info a inner join ifm_sendpage_info b on a.ifm_id = b.ifm_id inner join ifm_sendpage_contents_info c on b.sendpage_id = c.sendpage_id" <BR>SQL += "where a.ifm_id = '"&FeedID&"' order by regdate desc"<BR>set rs = Conn.Execute(SQL)<BR>'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''loop<BR>Do until rs.EOF <BR><BR>   Set item = xmlPars.CreateElement("item")<BR>   Channel.AppendChild(item)<BR>   <BR>       set title = xmlPars.CreateElement("title") <BR>       set link = xmlPars.CreateElement("link")<BR>       set description = xmlPars.CreateElement("description")<BR>       set dcdate = xmlPars.CreateElement("dc:date")<BR>       set dcsubject = xmlPars.CreateElement("dc:author")<BR>    <BR>       item.AppendChild(title)<BR>       item.AppendChild(link)<BR>       item.AppendChild(description)<BR>       item.AppendChild(dcdate)<BR>       item.AppendChild(dcsubject)<BR>    <BR>       item.childnodes(0).text = rs("sendpage_title")<BR>       item.childnodes(1).text = "<A href='http://localhost/?ifm_id="&rr&"&sendpage_id'>http://localhost/?ifm_id="&rr&"&sendpage_id</A>=" & rs("sendpage_id")<BR>       item.childnodes(2).text = rs("sendpage_contents")<BR>       item.childnodes(3).text = rs("regdate")<BR>       item.childnodes(4).text = rs("chat_id")<BR>'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''<BR>rs.movenext<BR>loop<BR><BR>Response.Write xmlPars.xml<BR>rs.close<BR>set rs = nothing<BR>Set xmlPars = nothing<BR>%><BR><BR>

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Edward,yoon

Software Developer
NHN, corp.
Korea (Republic Of) Korea (Republic Of)

Member

My name is Edward J. Yoon (윤진석), a worker for the NHN, cop. I'm also a founder/developer of the Apache Hama project which is Parallel Matrix Computational Package, and Apache Hadoop.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
QuestionWhere's the article? Pinmembermav.northwind2:13 13 Jan '05  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web01 | 2.5.120517.1 | Last Updated 12 Jan 2005
Article Copyright 2004 by Edward,yoon
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid