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.

Let's
begin,

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 foes, the XML will not be usable. To clear up whitespace, we use
the tag below:

<cfsetting
enablecfoutputonly="yes">

Next
we will connect to our database and get the tutorials (or whatever you want
to syndicate):

<!--- this is the area your users will really want, these are the actual
RSS items.. where you have your news or your content itself --->
<cfoutput><item><title>#title#</title>
<description>#description#</description><link>http://tutorial#qGetTutorials.tutorial_id[ctr]#.easycfm.com</link><author>#author_email#
(#author#)</author><pubDate>#date#
#time#</pubDate>
</item> </cfoutput>
</cfloop>
<cfoutput></channel>
</rss></cfoutput>
</cfsavecontent>

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:<cffile action="write"
file="#expandPath(".")#\EasyFeed.xml"
output="#theXml#">

If you want
to process with the CFML file, simply add this:

<cfcontent
type="text/xml">
<cfoutput>#theXml#</cfoutput>

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

How do you get the client machine name in coldfusion?
Thankz in advance,
Lionheart

Posted on 10/15/2005

The feed is working great, but I want to do real-time updates. If I add a document to my Web site at 1:00 p.m., and then another at 1:15 p.m., won't this RSS feed-creator just overwrite the first document? Isn't that a problem for folks whose feed readers aren't continuously grabbing content? I'd really appreciate hearing from anyone who can advise me on this. --diane

Posted on 07/21/2005

...watch out for white space. If you get an XML error (like I did on CF7), remove the and bring all the code up so there are no empty lines in the resulting XML file.

Posted on 07/11/2005

dear sir,
i am curious if my webpage is written in html, where do i put the rss feed information?
can i put it anywhere, or does it have to be in the description, title?
thank you,
chief9898@msn.com

Posted on 06/12/2005

i am new to this rss feeds,
i am very good at html coding,
i read your article on rss feeds and it is confusing to someone who has no knowledge of this,
could you give a sample of such feeds and what it would look like
some of the writing is in red color some in blue, which would i enter to create a rss feed?
any and all help is greatly appreciated.
thank you,
chief9898@msn.com

Posted on 06/12/2005

Instead of using a replace function within a cfscript (which is missing the >). Why not just use the string function #XMLFormat(string)# for the title, description, etc.. areas instead?
It would also seem that if you are syndicating long blocks of content (such as full articles formatted in HTML) it may be wise to parse the data to just an excerpt of 50 words or less.
Just a thought.

Posted on 03/27/2005

Mind posting some info on how we can use CFSchedule to automatically and routinely update the XML file created by cffile?

Posted on 01/19/2005

I never used this tutorial because I thought it would only work in CFMX, when in fact it does work in CF 5.0