Specifying an external source for the CFPOD tag in ColdFusion

Readability

Specifying an external source for the CFPOD tag in ColdFusion

The fol­low­ing exam­ple shows how you can spec­ify an exter­nal URL by set­ting the source attribute on a CFPOD tag in ColdFusion.





And the exter­nal .CFM doc­u­ment, getRSS.cfm, is as follows:


    

RSS feed URL not specified!

And the out­put of the <CFPOD> tag is as fol­lows:

The following example shows how you can specify an external URL by setting the source attribute on a CFPOD tag in ColdFusion.

<cfpod title="ColdFusion Examples RSS Feed"
        source="getRSS.cfm?feed=http://coldfusionexamples.com/feed/"
        width="400" height="100" />
 
<br />
 
<cfpod title="dHTML Examples RSS Feed"
        source="getRSS.cfm?feed=http://dhtmlexamples.com/feed/"
        width="400" height="100" />
 
<br />
 
<cfpod title="ActionScript Examples RSS Feed"
        source="getRSS.cfm"
        width="400" height="100" />

And the external .CFM document, getRSS.cfm, is as follows:

<cfif NOT structKeyExists(URL, "feed")>
    <h2>RSS feed URL not specified!</h2>
    <cfabort />
</cfif>
 
<cffeed action="read"
        source="#URL.feed#"
        query="rssFeed" />
 
<ul>
<cfoutput query="rssFeed">
    <li>[#dateFormat(rssFeed.publishedDate)#] <a href="#rssFeed.rssLink#">#rssFeed.title#</a></li>
</cfoutput>
</ul>

And the output of the <CFPOD> tag is as follows:

Leave a Reply

Your email address will not be published.