July 24, 2004
Structures in CFMX
CF uses structures quite a bit, there are several internal structures within CF, this encompasses all variable scopes and these can be exploited utilizing structure functions.
First the structures in CF are
- Application
- CGI
- Session
- Client
- URL
- Form
- Request
- Server
- Cookie
- Attributes
- CFCatch
- CFError
- CFFtp
- CFHttp
- File
- ThisTag
So let's say you wanted to clear session variables, try using
<cfscript>
structclear(session);
</cfscript>
Or let's say you wanted to verify that a form submission caused an action page.
<cfif structkeyexists(form, "fieldvalue")>
There are several uses that can be manipulated.
you missed out the arguments scope although here's a "gotcha" interaction between scopes...
I had grief with CFFUNCTION and an argument variable being the same name as a local (var) variable.
<cffunction name="test" returntype="string">
<cfargument name="myVar" type="string">
<cfset var myVar = "test2">
this will error, even though it seems they belong to two different scopes (local and argument). "Cannot declare local variable myVar twice"
seems like the arguments scope is copied into the local function scope after the cfargument tags, so all arguments are also in the local var scope
just thought I'd bring it up since scopes do interact - they *are* just structs - like Elyse said...
cheers
barry.b
Finally passed the test
Managing in light of McGregor's Theory X and Theory Y
CMMI
Kicking HIT Leadership Up a Notch
That's just some mumbo jumbo project management BS
Outcomes - The tactic to get to the strategy
Nurse Call, VOIP, and Wi-Fi: Its just cool when things come together!
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
December 2006
November 2006
August 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
November 2005
October 2005
September 2005
August 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
December 2003
November 2003
October 2003
Joel on Software
David Ross
Edward Prevost
Martin Fowler
The Health Care Blog
The Tales of Hoffman
The Business Word
Medical Rants
Christina's Considerations
Paul Levy
HIS Talk
Appropriate IT
Candid CIO
RSS feed




