-----Original Message-----
From: Tim Kearsey (Esense Limited) [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 15, 2001 9:46 AM
To: '[EMAIL PROTECTED]'
Subject: New formURL2Attributes.cfm


I got this from [EMAIL PROTECTED], can't find it at www.fusebox.org. 
It only works on CF 4.5+.
Got it on live servers and it's very stable. 
It runs in 10ms, the old one was taking about 150ms.

Tim

<cfsilent>
        <!--- This tag will turn all 'Form' and 'URL' scoped variables into
'Attributes' scoped 
        variables.  This allows you to have a common scope of variables,
thus allowing you to 
        call the entire application i.e. index.cfm as a CFMODULE or as a
regular application.
        Designed for: CF 4.5+ --->
        <cfif not isdefined('caller.attributes')>
                <cfset caller.attributes=structnew()>
        </cfif>
        <cfif NOT StructIsEmpty(url)>
                <cfif StructIsEmpty(caller.attributes)>
                        <cfset caller.attributes=structcopy(url)>
                <cfelse>
                        <cfloop collection="#url#" item="urlname">
                                <cfif not StructKeyExists(caller.attributes,
urlname)>
                                        <cfset caller.attributes[urlname] =
url[urlname]>
                                </cfif>
                        </cfloop>
                </cfif>
        </cfif>
        <cfif NOT StructIsEmpty(form)>
                <cfif StructIsEmpty(caller.attributes)>
                        <cfset caller.attributes=structcopy(form)>
                <cfelse>
                        <cfloop collection="#form#" item="field">
                                <cfif not StructKeyExists(caller.attributes,
"urlname")>
                                        <cfset
caller.attributes[field]=form[field]>
                                </cfif>
                        </cfloop>
                </cfif>
        </cfif>
</cfsilent>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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

Reply via email to