I have the need to display an xml document. so I am using cftree to do that. 

to build the cftreeitems, it is easiest to recursively call the renderer for 
each node.  BUT the cf compiler 'expects' the cftreeitem tags to be in the 
SOURCE FILE AFTER the CFTREE tag.

if I generate the tree items (savecontent) and write the tree data to a file, 
then cfinclude the file, it works.. but

1. its a lot of file I/O overhead
2. I have multiple users that could cause a data file collision
3. using a file is the wrong way to do it..

any suggestions
this is how I have my code now (which fails if I don't use the save file 
technique

<pre>
<cfdump var="#cgi#">
<cffunction name="displaytree" returntype="void" access="public">
        <cfargument name="varname" required="yes" type="string">
        <cfargument name="node" required="no" default="">
        <cfset var keys="">
        <cfset var i="">
        <cfset keys=structkeyarray(#evaluate(arguments.varname & 
arguments.node)#)>     
        <cfif #arraylen(keys)# gt 0>
                <cfloop index="i" from="1" to="#arraylen(keys)#">
                  <cfset x=#arguments.varname# & #arguments.node# & "." & 
keys[i]>
<!---......>      <cftreeitem display="#keys[i]#"  target="_blank" value="#x#" 
expand="no">
                        <cfinvoke method="displaytree">
                                <cfinvokeargument name="varname" 
value="parsed_inv_xml">
                                <cfinvokeargument name="node=" 
value="#arguments.node#.#keys[i]#">
                        </cfinvoke>
                </cfloop>           
        </cfif>
</cffunction>
<cfset sep='\'>
<cfset listl=listlen(#cgi.CF_TEMPLATE_PATH#,#sep#)>
<cffile action="read" 
file="#listdeleteat(cgi.CF_TEMPLATE_PATH,listl,sep)#/testout.xml" 
variable="inv_xml">
<cfscript>
        parsed_inv_xml=xmlparse(inv_xml);       
</cfscript> 
<cfform name="x">
<cftree format="flash" name="t">
        <cfinvoke method="displaytree">
                <cfinvokeargument name="varname" value="parsed_inv_xml">
        </cfinvoke>
</cftree>
</cfform>
</pre> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:317646
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to