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.
<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)#”>
#feedsXML.opml.body.outline[i].XmlAttributes.title#
-
#feedsXML.opml.body.outline[i].outline[j].XmlAttributes.title#
</li>
</cfloop>
</ul>
</div>
</cfloop>
</cfoutput><cfcatch type=”any”>
Error
There’s a problem with the script that powers this section.
</cfcatch>
</cftry>
</cffunction>
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?
LikeLike
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.
LikeLike