This is how it should act, the varibles scope in CFC is a way to keep things truly 'hidden' form the outside world, as 'this' scope is not a true black box. Please also note, that to my best knowledge, if you define a variable inside a function which is inside a CFC without a prefix 'var' that variable is inside CFC's variables scope. Thus, any other function can access it.

TK
  ----- Original Message -----
  From: Michael S. Hodgdon
  To: CF-Talk
  Sent: Saturday, November 08, 2003 2:40 PM
  Subject: CFC's behaving strangely on my machine

  For some reason, unnamed scoped variables within CFCs appear to not work.
  Code below:

  Salary.cfc
  <cfcomponent>
  <cfset acfc = "My CFC">

  <cffunction name="test" output="Yes">
  #variables.acfc#
  </cffunction>
  </cfcomponent>

  and my call to Salary.cfc
  <cfset c = CreateObject('component', 'Salary')>

  <cfoutput>#c.test()#</cfoutput>

  Ok, so my understanding is that when I call this cfc it should report an
  error that element "acfc" is undefined in "variables".  However, when on the
  calling page it in fact outputs "My CFC" to the user?  Shouldn't the unnamed
  and variables scope be different?

  Maybe my brain is fried or my install is!!!!!

  Any help?


[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to