In CF8, I have a working cftree with an RSS feed per node (multiple nodes). The problem is that I am not currently using a bind which means that all the feeds are read when the page is loaded which takes a very long time. What I want to do is bind the cftreeitem to a cfc so that the feed is only read when the user selects the parent cftreeitem and not on page load. The page is not throwing an error but none of the children nodes of the feed are showing under the parent.
cfm:
<cfform name="RSS_exercise">
<cftree name="Xfeeds" format="html" cache="no">
<cftreeitem value="elite" display="<div style='color:##4c4c4c'>ELITE FTS</div>" queryasroot="true" expand="no">
<cftreeitem value="" bind="cfc:components.rssQ.getEliteRSS({cftreeitempath}, {cftreeitemvalue})">
</cftree>
</cfform>
cfc:
<cffunction name="getEliteRSS" access="remote" returntype="any" hint="gets EliteFTS RSS feed">
<cfargument name="itemPath" type="string" required="false"/>
<cfargument name="itemValue" type="string" required="false"/>
<cffeed source="http://feeds2.feedburner.com/EliteftsArticles" properties="eliteProps" query="eliteRSS">
<cfset var feedArray = ArrayNew(1) />
<cfset var feed = StructNew() />
<cfset var i = 1 />
<cfoutput query="eliteRSS">
<cfset feed.value = "" />
<cfset feed.display = "#title# <div style='color:gray'>Published: #DateFormat(publisheddate)#</div><br/>" />
<cfset feed.href = "#rsslink#" />
<cfset feed.target = "_blank" />
<cfset feed.parent = "elite" />
<cfset feed.queryAsRoot = "false" />
<cfset feed.expand = "no" />
<cfset feedArray[i] = Duplicate(feed) />
<cfset var i = "i++" />
</cfoutput>
<cfreturn feedArray />
</cffunction>
Thank you very much for any help.
Made the following changes and now get the output, but it is nested/looped and I can't get the top level parent node so that they are not all flat. The point of doing this was so that there would be 1 parent that would not load the feed until checked.
cfm
<cfform name="RSS_exercise">
<cftree name="Xfeeds" format="html" cache="no">
<cftreeitem bind="cfc:components.rssQ.getEliteRSS({cftreeitempath}, {cftreeitemvalue})">
</cftree>
</cfform>
cfc
<cffunction name="getEliteRSS" access="remote" returntype="array" output="no" hint="gets EliteFTS RSS feed">
<cfargument name="itemPath" type="string" required="false"/>
<cfargument name="itemValue" type="string" required="false"/>
<cfset var feedArray = ArrayNew(1) />
<cfset var feed = StructNew() />
<cfset var i = 1 />
<cffeed source="http://feeds2.feedburner.com/EliteftsArticles" properties="eliteProps" query="eliteRSS">
<cfloop query="eliteRSS">
<cfset StructClear(feed) />
<cfset feed.value = "1" />
<cfset feed.display = "#title# <div style='color:gray'>Published: #DateFormat(publisheddate)#</div><br/>" />
<cfset feed.href = "#rsslink#" />
<cfset feed.target = "_blank" />
<cfset feed.parent = "elite" />
<cfset feed.queryAsRoot = "false" />
<cfset feed.expand = "no" />
<cfset feedArray[i] = Duplicate(feed) />
<cfset i++ />
</cfloop>
<cfreturn feedArray />
</cffunction>