Rick - in the CFC function, variables.DSN refers to the variables scope 
within the CFC only.  So, you are setting the variables.DSN value, in the 
instance of the object you're creating, to the value that is passed in as an 
argument, arguments.DSN.

The variables scope within a CFC is local to that CFC, and cannot be 
accessed from outside it.  Thus, any use of the variables scope from your 
calling page, will be entirely separate from any use of the variables scope 
within the CFC.  This is why you have to pass in values to your CFC via 
arguments, so that the CFC variable values (the "object instance" values 
more specifically) can be set in the init function of the CFC.

This is quite different than the use of cfinclude -- it's a whole different 
way of thinking about things so it takes a while to wrap your mind around 
it.

-- Josh


----- Original Message ----- 
From: "Rick Faircloth" <[EMAIL PROTECTED]>
To: "CF-Talk" <cf-talk@houseoffusion.com>
Sent: Saturday, June 21, 2008 9:44 AM
Subject: Clarification Required Concerning CFC...


> Hi, all...
>
> This statement in a CFC function confuses me:
>
> <cfset variables.DSN = arguments.DSN />
>
> Why?  Because it seems backwards.  It seems to me that
> I've already defined my variables.DSN values outside of
> the CFC and am passing that value into CFC as an argument.
>
> It only makes sense, then, for me to use this, instead:
>
> <cfset arguments.DSN = variables.DSN />
>
> Backwards from the way it was written above.  It seems I should
> be setting arguments.DSN equal to variables.DSN.
>
> According to this example written from the calling page:
>
> <cfset variables.DSN = "myDSN" />
> <cfset obj = createObject("component", "Object") .init(variables.DSN) />
>
> I'm creating an object and specifying the DSN value as "variables.DSN",
> and it only makes sense that in the called CFC function, that the function
> would then create a value for arguments.DSN equal to variables.DSN or,
> <cfset arguments.DSN = variables.DSN />.
>
> Can someone explain why it's not backwards to write
> <cfset arguments.DSN = variables.DSN /> in the function?
>
> Thanks,
>
> Rick
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:307913
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to