Well, if it looks right...

I just recreated the little example I gave and it worked as I would have
expected (output= yes/20).  The <cfparam>'s don't alter the attribute.cfg.param
values.  The real app is a bit more complicated, but not much more so.  I'll
just have to debug it further.

Would I be correct in assuming that the way to pass the struct, without the
danger of the cfml tag altering its contents should be:

<!--- Call to mytag.cfm, passing configuration struct --->
<cf_mytag cfg="#Duplicate(cfg)#">

Thanks.


----- Original Message ----- 
From: "Raymond Camden" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Monday, September 15, 2003 12:39 PM
Subject: RE: Passing a Struct to a Custom Tag


> Unless I'm missing a typo, it looks correct to me. Maybe cfparam gets
> confused by the path? What happens if you change the first cfparam to:
>
> <cfif not isDefined("attributes.cfg")>
> <cfset attributes.cfg = structNew()>
> </cfif>
> <cfif not structKeyExists(attributes.cfg,"param1")>
> <cfset attributes.cfg.param1 = "no">
> </cfif>
>
> ========================================================================
> ===
> Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc
> (www.mindseye.com)
> Member of Team Macromedia (http://www.macromedia.com/go/teammacromedia)
>
> Email    : [EMAIL PROTECTED]
> Blog     : www.camdenfamily.com/morpheus/blog
> Yahoo IM : morpheus
>
> "My ally is the Force, and a powerful ally it is." - Yoda
>
> > -----Original Message-----
> > From: Jim McAtee [mailto:[EMAIL PROTECTED]
> > Sent: Monday, September 15, 2003 12:36 PM
> > To: CF-Talk
> > Subject: Passing a Struct to a Custom Tag
> >
> >
> > How do you pass a struct as an attribute to a custom tag? (CF5)
> >
> > I've got an app structured something like:
> >
> > <!--- application.cfm --->
> > <cfset cfg = StructNew()>
> > <cfset cfg.param1 = "yes">
> > <cfset cfg.param2 = "20">
> >
> > <!--- mypage.cfm --->
> > <cfinclude template="header.cfm">
> > <cf_mytag cfg="#cfg#">
> > <cfinclude template="footer.cfm">
> >
> > <!--- mytag.cfm --->
> > <cfparam name="attributes.cfg.param1"   default="no">
> > <cfparam name="attributes.cfg.param2"   default="100">
> > <cfoutput>
> > #attributes.cfg.param1#<br>
> > #attributes.cfg.param2#<br>
> > </cfoutput>
> >
> > And always get as output
> >
> > no
> > 100
> >
> > I realize that I haven't yet dealt with the issue of CF
> > passing structs by reference, but it seems that the <cfparam>
> > tags shouldn't alter the variables in this instance.
> > Obviously I'm doing something else wrong.
> >
> >
> >
> >
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/lists.cfm?link=t:4
Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Get the mailserver that powers this list at 
http://www.coolfusion.com

Reply via email to