TerrenceRyan.com

I'm a 35 year old redhead geek from Philly.
I'm currently a Developer Evangelist for Adobe.
Also the author of Driving Technical Change

More Site Nonsense

2 Comments

I have weird little preferences about my site, and I really wanted my links section to to come from my list of RSS feeds. But I use Sharpreader which is is a desktop client so I can't just pull my links in from another site., or publish, or work any other magic. However, Sharpreader can export to an OPML file, which is just a variant of XML. So I should be able to download a CFML OPML parser. Turns out that by "download," I mean "construct." Since I couldn't find one, I've included the source to make it happen. Enjoy, don't enjoy, use, don't use, whatever.

<cffunction access="public" name="display_opml" output="true" returntype="void" hint="Takes an opml file and outputs a list of links. "> <cfargument name="opml_file" type="string" required="yes" default="" hint="The file location of the opml file to display."> <cftry> <cffile action="read" file="#arguments.opml_file#" variable="feeds"> <cfset feedsXML=XMLParse(feeds)> <cfoutput> <cfloop index="i" from="1" to="#ArrayLen(feedsXML.opml.body.outline)#"> <div class="entry"> <h2><span>#feedsXML.opml.body.outline[i].XmlAttributes.title#</span></h2> <ul> <cfloop index="j" from="1" to="#ArrayLen(feedsXML.opml.body.outline[i].outline)#"> <li> <a href= "#feedsXML.opml.body.outline[i].outline[j].XmlAttributes.htmlUrl#"> #feedsXML.opml.body.outline[i].outline[j].XmlAttributes.title# </a> <div class="feed"> <a href="#feedsXML.opml.body.outline[i].outline[j].XmlAttributes.xmlUrl#"> RSS</a> </div> </li> </cfloop> </ul> </div> </cfloop> </cfoutput> <cfcatch type="any"> <div class="entry"> <h2><span>Error</span></h2> <p>There's a problem with the script that powers this section.</p> </div> </cfcatch> </cftry> </cffunction>

2 responses so far ↓

  • 1 Ryan

    That's pretty sweet. I don't use Sharpreader, but if I did, I'd steal that code Thomas Crowne Affair style.

    Also, where are the cigar posts?
  • 2 Terrence Ryan

    Does that make me Rene Russo in this scenario? I'm not sure if I'm comformtable with that.

    Cigar posts are coming. I haven't had a lot of new cigars lately.

Leave a Comment









Categories

Monthly Archives

Tag Cloud

coldfusion web development flex coldfusion builder appearances squidhead coldfusion builder extensions higher ed html5 flash builder air mobile android driving technical change adobe apptacular running a coldfusion shop adobemax06 movable type flash catalyst flash css blackberry adobemax07 adobemax08 hero finicky adobemax09 holy crap i’m a mobile developer centaur phonegap basecamp cfc whichelement unfuddle motorola metablog irrational characters ios git evangelism edge devices code reviews ant wharton subversion security rhino philly philadelphia multidevice knowledge@wharton jobs javascript java browserlab adobemax10 adobe tv unfuddlecfc svnauth.cfc semantic html semantic html responsive web design qnx nlb linux jquery mobile it github flexorg fireworks eclipse dreamweaver apps apple adobemax11