• Horn Player – Computer Dude – Gig Pig …
  • Home
  • About
  • Blog
  • Services
  • Contact
  • Webmail
  • Terms

Robert A. Owen - Musician - Technology Leader

Music, Technology, Rants and Funnies - Randomness at its best!

  • Blog
  • Internet
    • IIS 6
    • IIS 7.5
    • Javascript
    • Web Design
      • WordPress
      • Coldfusion
  • Support
    • MicroSoft
      • Powershell
      • Surface
      • Windows10
      • Zune
    • PC-Care
    • Software
    • Virus
      • Email Scam
    • Vista Quest
    • Windows 7
  • Pictures
    • Instagram
  • Music
  • Friday Funnies
  • General
    • CoWorking
    • Gadgets
    • Politico
    • Random – TidBit
    • Rant
    • Review
    • Site of the Week
    • Useless
    • Xbox
      • Games
You are here: Home / Coldfusion / Get an RSS Feed with ColdFusion

Get an RSS Feed with ColdFusion

September 11, 2006 By Robert Owen

Ok, I’m probably last man to the party with this one but I thought I’d share. I can’t remember where I found this bit of code but, it is pretty darn handy! If you want to add your favorite RSS feed to your site and have it update dynamically, then this is for you.

<code>
<cfset maxEntries = 2>
<cfset theURL = “https://www.owenwebs.com/blog/rss.cfm?mode=short”>
<center><u>Latest From the <a href=”https://www.owenwebs.com/blog”>Random Blog</a></u></center>
<br>
<cftry>
<cfhttp url=”#theURL#”>
<cfset xml = xmlParse(cfhttp.filecontent)>
<cfset items = xmlSearch(xml, “//*[local-name() = ‘item’]”)>
<cfloop index=”x” from=”1″ to=”#min(arrayLen(items),maxEntries)#”>
<cfset item = items[x]>
<cfoutput>
<a href=”#item.link.xmlText#”>#item.title.xmlText#</a>
<br>
#item.description.xmlText#
<br>
<hr align=”center” width=”70%” size=”1″ noshade>
</cfoutput>
</cfloop>
<cfcatch>
<cfoutput>
Feed temporarily down.
</cfoutput>
</cfcatch>
</cftry>
</code>
Using cfset we will set the MaxEntries to get and the URL we will get them from. Then it uses cfhttp to goto our URL and parse the xml. Then it loops through to get our max entries.
And, because we use cftry, if there are any errors we can output a message saying the feed is temporarily down.

© 2006 – 2009, Robert Owen. All rights reserved.

Related posts:

Default ThumbnailTime to learn CFCs once and for all! Default ThumbnailWow!! Long time now type! Default ThumbnailCFX_PFPro_Java Download – Finally Default ThumbnailColdfusion 7

Filed Under: Coldfusion

Robert Owen A Horn Player turned salesman, turned Computer Consultant & Horn Player, Turn Network Engineer & Horn Player, Now Technology leader & Musician.... Well, How about a Horn player who does a lot of other stuff? More about me. FacebookInstagramLinkedInTwitter

To Stay up-to-date on all of my crazy Ramblings, enter your e-mail address below.

You'll be amazed!

Recent Posts…

  • What If? – Gig Edition
  • Feedback – two way street
  • Snow-pocalypse… and Cold
  • Snow-pocalypse 2025 – part 6
  • Snow-pocalypse 2025 – part 5

Recent Comments

  • David Gray on Create a Shortcut to open in your Alternate BrowserTwelve years on, this tip remains useful. Though I…
  • Sue K on Use the Snipping Tool to Capture MenusThanks you so much! I could never figure out how t…
  • aa on Increase IIS File Upload LimitsSuperb Robert..after wasting 2 days..this is perfe…
  • León on Windows 7 error 86Funciono para Windows 7 , también descubrí que la…
  • Nicole Larkin on Use the Snipping Tool to Capture MenusNine years later and your post is still helpful. T…

[footer_backtotop]
Content Copyright © 2025 OWEN CONSULTING · All Rights Reserved · Log in