Skip to main content

Create RSS with Simple Example

  • Content
  • What is RSS and Usage
  • How do i subscribe to RSS
  • Creating the XML file
  • Creating the HTML file
  • Testing The Sample
What is RSS and Usage

RSS - Really Simple Syndication also known as Rich Site Summary. RSS feeds provide Webmasters and content providers to update their site summaries to Readers of the site.

example:
A blog sites are always updating by new articles daily.
If a reader of that blog wanted to read newly posted articles, he or she wanted to go to the site and check whether there are any new posts available.
Without going to the blog site if they can check are there any new posts available. If so, readers can check the post's title and description then by selecting particular title and log into that article directly....It'll be easier for that reader.

For that owner of the blog site has to do update a xml file with summary of newly posted articles and give a link to that file.
Readers have to do subscribe for that link and get that newly posted article's summaries to RSS reading software. (Firefox has inbuilt RSS reader. )
Now Redaer can check are there any Newly updated articles available or not.

How do i subscribe to RSS

All you have to do go to the site which is give RSS feature. Almost Every updating websites are providing this feature (News sites).
You Can see These kind of RSS logos.




Just click on that picture from selected site. Before that you should have installed RSS reading Software. (FeedDemon from feeddemon.com)
You can use Firefox.

Creating the XML file

Lets move on to a simple example. RSS content stored in a XML file. lets create that file.
Assume your publishing new posts to your blog site. Readers of your site needed to know your newly posted articles. So after publishing your new posts to the blog your creating or updating your RSS file. Saying that i have published these articles and here are those article's titles, description and the link for that article

Type following in notepad and save it as "newposts.xml".


<rss version="2.0">
<channel>
<title>New Posts</title>
<description>July articles are now available</description>
<link>http://localhost/rss/newposts.html
<item>
<title>Article 1</title>
<description>Small Description of Article 1</description>
<link>http://localhost/rss/article1.html
</item>
<item>
<title>Article 2</title>
<description>Small Description of Article 2</description>
<link>http://localhost/rss/article2.html
</item>
<item>
<title>Article 3</title>
<description>Small Description of Article 3</description>
<link>http://localhost/rss/article3.html
</item>
</channel>
</rss>


this is a simple file. Try to understand it. it'll be very easy. Above tags <channel>,<rss>,<Title>,<Description> and <link> are vital tags. beyond that there are more tags are using to describe the RSS.

like pubdate,lastbuilddate,language,copyrght,category,docs...and more. As a beginner we can start with above and you can find many tags from the internet.


Creating the HTML file

Now you created the xml file. I have saved that file in http://localhost/rss/newposts.xml

lets create a html file which is tells the user to subscribe to newly posted RSS Feed.

type following in notepad and save it as welcome.html. i am putting that file in http://localhost/rss/welcome.html

<html>
<head>
<LINK rel="alternate" type="application/rss+xml" title="RSS Newly Posts" href="http://localhost/rss/newposts.xml">
</head>
<body>
<h1>Click <a href="http://localhost/rss/newposts.xml">here</a> to Subscribe to newly posted articles</h1>
</body>
</html>

The following line tells to the rss readers to where is the RSS file located. Rss Reader will get the content of that file and shows you in a propper way.

<LINK rel="alternate" type="application/rss+xml" title="RSS Newly Posts" href="http://localhost/rss/newposts.xml">

Testing The Sample

This example is tested on apache web server Using Firefox as a web browser and RSS reader.
first of all reader has to subscrbe to that page.
i am loggin to that welcome page using firefox.





Then readers have to check whether there are any new posts available daily by clicking on that bookmark.
Webmaster has to do update that xml file when there are any new posts.

Comments

Post a Comment

Popular posts from this blog

How To Disable Export Button In Crystal Report When you are taking crystal report printouts through a program, such as program written using vb6. you might have a problem how to disable Export button in print preview. All you have to change following property to false or Uncheck the Export option in Property Pages. You CR.WindowShowExportBtn = False Crystal Report Object in Visual Basic 6. (CR is refer to Crystal Report Object ) You can go to Property Pages by right click and choose Properties on Crystal Report Object After you done those things you crystal Report print preview will showing like follows. I was face to above problem. We implemented a software program which is written using vb6. Cashier can take daily sale print out. before printing it is showing a preview to the user. So when the time pass user click export button and saved that report as a excel file. Then he modified the values and took printout to the management. That gives Security problem to the program a

Magento Generate Google Sitemap using Cron

I had a problem with generating the Google sitemap using cron job. To do that you can simply change following database value. SELECT * FROM core_config_data WHERE path = 'crontab/jobs/sitemap_generate/schedule/cron_expr' Change the value as you set time in cron jobs. EX: Generate the Sitemap for every 5 minutes value = */5 * * * * That's it. Now you have to worry about cron is working or not. Just type following in your browser and hit enter. http://youresite.com/cron.php
Git script which shows little bit advanced status. Save with Preferred file name in /usr/local/bin/XX branch="" branches="git branch --list" ESC_SEQ="\x1b[" COL_RESET=$ESC_SEQ"39;49;00m" COL_RED=$ESC_SEQ"31;01m" while read -r branch; do clean_branch_name=${branch//\*\ /} description=`git config branch.$clean_branch_name.description` if [ "${branch::1}" == "*" ]; then printf "$COL_RED$branch$COL_RESET $description \n" else printf " $branch $description\n" fi done <<< "$branches" git status Use the following command to add a description to your local branches. git branch --edit-description