For those who have installed SP2 for CF 4.5.1, you may notice a few new
functions. One of them was almost perfectly designed for Fusebox. This is
the StructAppend() function
(http://127.0.0.1/CFIDE/Administrator/docs/451update.htm#1026139).
What this function does is take 2 structures and appends ALL of the values
from one of them onto the other. This sounds very much like what the
formurl2attributes fuse does. Lets look at some example code that takes the
URL and FORM variables and appends them to the Attributes structure.
<!--- If the Attributes scope is not defined, create it. The only time it
will not be defined is when you are not within a custom tag --->
<CFIF Not IsDefined('Attributes')>
<CFSET Attributes=StructNew()>
</CFIF>
<!--- Append ALL Url variables onto the Attributes structure. This will
overwrite variables of the same name. --->
<CFSET StructAppend(Attributes, Url)>
<!--- Append ALL Form variables onto the Attributes structure. This will
overwrite variables of the same name. --->
<CFSET StructAppend(Attributes, Form)>
Now this may not be exactly what is needed in Fusebox, but its enough to
show everyone what this new function is, what it does and how to use it. I
expect it to become a well loved part of the methodology fast. :)
Oh, one small note is that if you do not want the StructAppend() function to
overwrite a variable in the 'target' function, you just have to add an
additional attribute to the function. i.e.
<!--- Append ALL Form variables onto the Attributes structure. This will NOT
overwrite variables of the same name. --->
<CFSET StructAppend(Attributes, Form,0)>
Notice the third attribute which has a Boolean value of 0 (or no). This
simply says, don't overwrite.
Michael Dinowitz
Publisher: Fusion Authority weekly news alert
(www.fusionauthority.com/alert)
Listmaster: CF-Talk, CF-Jobs, Spectra-Talk, Jrun-Talk, etc.
(www.houseoffusion.com)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists