You're the only person who has taken a stab at this, so thank you very much!
It is my understanding that caller.message and attributes.message point to the same
thing, but that any modifications that refer to it as "attributes.message" will be
strictly local to that invocation of the tag. Is anyone willing to help with my
understanding of caller vs. attribute, without necessarily getting too involved in the
headache-y recursion? *grin*
Thanks,
Carol
>>> [EMAIL PROTECTED] 08/21/00 04:53PM >>>
Hi, Carol.
Perhaps your recursive invocation of cf_output_unknown needs to pass
caller.message as the message= argument rather than the attributes.message.
I may be getting wrapped around the recursion here, but it seems to me that
within a given invocation of cf_output_unknown you modify caller.message
with by appending the value of the argument test_object (or an element of
it) to the value of the message argument. But then you pass the unmodified
attributes.message to the next level of recursion. (Of course, if in the
final analysis the caller and attributes scopes actually point to the same
value because of the recursion then this advice doesn't mean much.)
HTH,
-- Tim Dempsey
-----Original Message-----
From: Carol Chandler [mailto:[EMAIL PROTECTED]]
Sent: Monday, August 21, 2000 4:48 PM
To: [EMAIL PROTECTED]
Subject: Help with custom tag
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/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
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.