Tuesday 13 May 2008   
Add Comment

Using CFFEED to create a RSS Feed Tutorial

ColdFusion Tutorial #27

In this tutorial, I show how to retrieve information from a database and create a valid RSS 2.0 feed from this data.

This tutorial should be easily adaptable for your own needs.

demo.cfm

Lines 1-5 just retrieve some data from the cfbookclub sample database.

Lines 7-13 create some required fields for a valid feed.

Line 15 sets up a loop to loop through the data.

Lines 16-24 populate the xml Structure with the data.

I think it is all self explanatory. However lines 18 & 19 define the type of id, a isPermaLink of yes means the guid.value needs to be a permenant link, otherwise it can be a uuid or similar.

Also, remember to xmlFormat and data going into the feed. I have also found that xmlFormat( does not remove high ascii characters, so if you have any of them in your data, you should remove or replace them manually.

 
 


Demo

See this code running!


Download

Download this code as a zip!


Comments

There are no comments!

Click button to add a comment


Author

Dale Fraser


Published

Thursday 24 Jan 2008

Tags

cffeed  cfloop  cfoutput  cfquery  cfset