Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Adding Live Content Feeds to your Blog or Website

0.00/5 (No votes)
31 Oct 2004 1  
How to add live content feeds to your weblog or web site.

RSSXML image

Introduction

Really Simple Syndicates (RSS) is an XML application for syndicating the web site contents. You must have seen applications of it on many web sites that include live feeds such as news from sources like CNN and BBC. To provide live content on your site or weblog, you need access to an XML based file called RSS. RSS file is simply a remotely hosted XML file that you can call into your pages.

However, since RSS is XML, there is some programming that needs to be done to make it browser-friendly. Unless RSS is formatted for a browser, the browser renders RSS as a raw XML format which is not user-friendly. This application provides code for transformation of RSS into a browser-friendly version using server-side and client-side code. Once the transformation is complete, the resultant output can be rendered (such as in an IFrame) in your weblog or website.

Using the code

There are four files included in the zip file.

  • rssserver.asp --> for server side transformation
  • rssclient.htm --> for client side transformation using JavaScript
  • rssfeed.xml --> a sample RSS file to test the code
  • rss.xsl --> XSL stylesheet template that performs the transformation

Call rssserver.asp like the following:

http://localhost/rssserver.asp?rss=rssfeed&xsl=rss 

where rssfeed is the name of the RSS file and rss is the XSL stylesheet

The code is fully commented and all the description is included within the sample.

Using code in your blog or site

It is normal practice to include live feeds into the site's home page. The easiest way to do this is to call the ASP file in an IFrame. Suppose the URL for your ASP file is http://www.mydomain.com/rssserver.asp. To call this into your blog, do this:

<iframe src="http://www.mydomain.com/rssserver.asp?rss=rssfeed&xsl=rss" 
        width="300" height="400"></iframe>

As an alternate, you can also use the JavaScript version to include live feeds using tables. For example:

<table border='0'><tr><td>

<!--add javascript code from rssclient.htm here-->

</tr></td><table>

Points of Interest

Adding live feeds to your website or blog is a great way to attract visitors and lure them into coming back for more. There are RSS feeds available for every imaginable topic - from programming to current news, tons of content is available for you to add.

Moreover.com and syndic8.com are good places to discover RSS files.

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