Click here to Skip to main content
15,867,141 members
Articles / Web Development / HTML
Article

Adding Live Content Feeds to your Blog or Website

Rate me:
Please Sign up or sign in to vote.
3.16/5 (12 votes)
31 Oct 20042 min read 124.1K   1.2K   41   4
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:

HTML
<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:

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


Written By
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

 
GeneralI'm always wondering how this rating system works Pin
Philipp Sumi1-Nov-04 3:07
Philipp Sumi1-Nov-04 3:07 
GeneralRe: I'm always wondering how this rating system works Pin
Nirosh10-Jan-07 18:30
professionalNirosh10-Jan-07 18:30 

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

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