Click here to Skip to main content
Click here to Skip to main content

Adding Live Content Feeds to your Blog or Website

By , 31 Oct 2004
Rate this:
Please Sign up or sign in to vote.

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>

<!--<span class="code-comment">add javascript code from rssclient.htm here--></span>

</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

About the Author

Rafay Bin Ali
Web Developer
Pakistan Pakistan
I am a freelance developer and technical author in Karachi, Pakistan. I am presently a student at Hamdard Institute of Management Sciences, City Campus, Karachi.
 
Email: rafayali@gmail.com
Blog: http://rafayali.blogspot.com
http://cc.1asphost.com/powerwebdev/index.htm

Comments and Discussions

 
QuestionCan it be changed to accept RDF? Pinmemberchksi3-Aug-05 13:27 
GeneralI'm always wondering how this rating system works PinmemberPhilipp Sumi1-Nov-04 3:07 
GeneralRe: I'm always wondering how this rating system works PinmemberNirosh10-Jan-07 18:30 

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.

| Advertise | Privacy | Mobile
Web02 | 2.8.140415.2 | Last Updated 1 Nov 2004
Article Copyright 2004 by Rafay Bin Ali
Everything else Copyright © CodeProject, 1999-2014
Terms of Use
Layout: fixed | fluid