Tutorial: How to implement a complete RSS feed and your favorite news feed links in your site?
In this tutorial, I will present how to make a new RSS feed in your site. I’ll explain the implementation issues, with different options (from easy or no coding t hard coding, etc) to perform the implementation. It is designed for ay people- non-programmers to programmers to design a RSS feed.
Ok, first I’ll present the big picture of the desired RSS feed.
A) Big Picture : First I’ll show what I want to make. The overall view is essential to present the RSS look-and-feel to your boss or administrator before doing any coding.
One ‘RSS’ button should make a link from one of your source page. Clicking on that button, the following page should appear.
Figure 1: Main view of the desired RSS feed
Now I will explain how to start coding. Before coding, two easy solutions are there that you can take into account. Start reading.
B) Easy solutions (mainly for non-programmers):
From the administrative point of view, you can do either of the following two things :
- Buy or ask for a RSS component to your web-design companies. Most web-design companies use CMS (content management systems) to make your site. And almost all CMS has plugins or extensions of RSS ready to be used in a site. It is just a matter of enabling the option into your site without almost any coding from your website designers. So don’t miss the chance asking them to enable that option!
- There are many free web-companies to prepare a RSS feed for your company. What you need to do is as follows: a) Make a XML RSS feed like Part C of this tutorial below, and b) link your prepared XML RSS feed from that web-company. Prior this operation you need to register. It is also simple, isn’t it?
However, if you want to program, keep on reading. I’ll touch every options to make your RSS workable and efficient.
C) Main RSS feed (The XML one!)
The left part of Figure 1 is actually the main RSS feed to be used in a website. It’s a XML file that Internet Explorer and many others can read and parse and present accordingly (with subscription link as well).
Tools like ‘Feed editor’ (need to be activated after a period), RSSEditor (free), etc can be used to make a RSS feed (xml file). You’ll put that xml file into your site and it works fine. However, you need to validate RSS feed using a plugin of those tools (if available) or different free validator around the web. You can get many such validators after doing a little searching in the web.
RSS Feed (test2.xml)
13 Nov 2008 11:33:23 GMT SACARs Articles Sa cars articles presented regularlywww.sacars.com.au http://blogs.law.harvard.edu/tech/rss 1440
New google map New google map showing all 13 service stationms of SACAR has been uploaded. (c) Manzur Ashraf 13 Nov 2008 20:14:47 GMThttp://www.sacars.com.au 99AC223C-729D-4B14-8A53-67187F24EA79
New FORD arrivales <P>Hello This is a test</P><P>By Mark Conway!</P><P> </P> 13 Nov 2008 19:39:35 GMTwww.sacars.com.au/assets/157/t2.html
SEO article <P>This is a test by manzur</P> 13 Nov 2008 19:39:38 GMTwww.sacars.com.au/assets/157/tt.html
C.1) Rendering XML rss feed into html :
However, if you want to code your own tool to view/render a XML page, you can use script like below. It is simply parsing a XML file from a URL (using URLToRSS) and present it using ASP scripts. You can also add CSS along with it to customize the design and look-and-feel of it.
File : asp_to_render_rss.asp
<% Response.Expires = -1 URLToRSS = "http://feeds.feedburner.com/Bytescout" MaxNumberOfItems = 7 MainTemplateHeader = "
Please contact web-master" ' ================================================ Set xmlHttp = Server.CreateObject("MSXML2.ServerXMLHTTP.3.0") xmlHttp.Open "GET", URLToRSS, false xmlHttp.Send() RSSXML = xmlHttp.ResponseText Set xmlDOM = Server.CreateObject("MSXML2.DomDocument.3.0") xmlDOM.async = False xmlDOM.validateOnParse = False xmlDom.resolveExternals = False If not xmlDOM.LoadXml(RSSXML) Then ErrorMessage = "Can not load XML:" & vbCRLF & xmlDOM.parseError.reason & vbCRLF & ErrorMessage End If Set xmlHttp = Nothing ' clear HTTP object Set RSSItems = xmlDOM.getElementsByTagName("item") ' collect all "items" from downloaded RSS RSSItemsCount = RSSItems.Length-1 ' if not
D) Right Part (Use of APIs)
The right part is optional but improves the overall visibility and accessibility of the site. You can import your favorite and relevant RSS feed news from different URLs and put in your website. It represents an animated news feed and increases the potentiality of your site.
Now both those pages (one is XML, another is html) can be linked together using a frame based html page like below.
Hope it covers the basic implementation issues of the proposed RSS feed in your website.
Don’t miss to look at detailed options presented in this tutorial. You can suggest me with any ideas or comments.
© Manzur Ashraf, Adtrans Ltd, SA 5081, Australia.