Hi list,
I'm working on my very first custom tag. I was writing a specific routine to collect
the contents of the CFCATCH structure when it occurred to me that a more general
solution might be useful. So, what this tag is intended to do is to take a variable -
simple, array, or structure, or any combination (array of structures of arrays, etc.)
- and append all of the component names and values into one string. What I have here
does correctly traverse and output a nest of structures/arrays, but I can't seem to
collect it all into one variable. There must be more to "caller.variable" than meets
the eye. What happens in the calling page is that "message" has the name of the last
component of the outer structure.
Can anyone tell me what I am missing? Thanks very much. (And I hope the recursion
doesn't give anyone a headache!)
<!--- CF_output_unknown [input] test_object [output] message ¯->
<cfif IsDefined("attributes.test_object") IS "No">
<cfset #caller.message# = "">
<cfelseif #IsSimpleValue(attributes.test_object)#>
<cfoutput>#attributes.test_object#</cfoutput>
<cfset #caller.message# = #attributes.message# & #attributes.test_object#>
<cfelseif #IsStruct(attributes.test_object)#>
<CFLOOP COLLECTION=#attributes.test_object# item="struct">
<cfset #caller.message# = #attributes.message# & #struct# & " = ">
<cfoutput><BR>#struct# = </cfoutput>
<CF_output_unknown test_object=#attributes.test_object[struct]#
message=#attributes.message#>
</CFLOOP>
<cfelseif #IsArray(attributes.test_object)#>
<CFLOOP index=i from=1 to= #arrayLen(attributes.test_object)#>
<CF_output_unknown test_object=#attributes.test_object[i]# message=
#attributes.message#>
</cfloop>
<cfelse>
<Cfset #caller.message# = #attributes.message# & "Unable to proceed with
CF_output_unknown.">
</cfif>
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebarRsts&bodyRsts/cf_talk or send a message
to [EMAIL PROTECTED] with 'unsubscribe' in the body.