Creating Your Very Own RSS XML Feeds with ColdFusion MX!
Have you ever wanted to create your very own RSS Feed? DO you have anything on your site you would like others to have access to?
Well, RSS (another form of XML) is easy to implement and can be very beneficial for your site and its users.
I implemented RSS/XML feeds in a few areas of EasyCFM to allow people to syndicate the tutorials, our news and more. This tutorial will guide you through the steps I used and teach you how to build the actual RSS feed.
The first thing we will do is to strip out WHITESPACE from our page, this is so the pages load faster when generating the RSS feeds (Also, remember that XML must have no preceding SPACES before the <?xml> tag. If it does, the XML will not be usable. To clear up whitespace, we use the tag below:
Next we will connect to our database and get the tutorials (or whatever you want to syndicate):
Now you have the option of load this from this file or you can save it to an actual .XML file, that choice is up to you! What’s the difference you ask?
It’s in the way you want your users to have access to your data… if you do it with the CFML file then they will be querying your database and generating the latest data every time, but they will be processing databases and COldFusion (which could slow your machine down). If you put it in an XML file, the data will not be the most recent, but no processing will be required at time of call by user. So the choice is up to you!
If you want to write, simply do this:
If you want to process with the CFML file, simply add this:
You now have your very own RSS Feed… the next to last step in your development is to authenticate and validate your feed. This step is crucial in ensuring that what you have built is actually USABLE
To validate your feed, simply go to:
Enter the direct URL to your feed and click the submit button… then you will get a full report of problems or a message stating that is is validated and usable.
The final step is to syndicate your site and let the world know where they can get your XML/RSS feed to use.. to achieve this there are many sites out there to syndicate. THe biggest one out there is:
Submit your site and you’ll be ready to go! Before you know it.. people will start using your content and sending YOU traffic!
Some last minute mentions, if you want to see the generated content (and example of what this HAS generated) you can access the EasyCFM.COM Tutorials RSS Feed, here:
If you want to then, learn how to process the data this generates, then check out my tutorial titled “Processing XML/RSS feeds with ColdFusion MX“.
EasyCFM.Com introduces at least three new tutorials each week, written by the webmaster (Pablo Varando) and also from individual people who post their own tutorials for visitors to learn from. For more information please visit: http://www.easycfm.com [EasyCFM is Hosted by Colony One On-Line – http://www.colony1.net]