I'm trying to set a few variables in my Application.cfc file and I'm a
bit confused about scopes.
Here's what I have got:
cffunction name=onApplicationStart
cfset APPLICATION.page_title = My Title
cfreturn True
/cffunction
I can access this anywhere in my site as
Yes, in the methods of Application.cfc, you need to specify the scope,
including the Application scope. For Application attributes
(sessiontimeout, name, etc), you can specify those in the THIS scope,
but only outside the methods:
cfcomponent
cfset this.name = myApp /
cfset
Thanks for clearing that up Jason.
On 2 Nov 2009, at 11:50, Jason Fisher wrote:
Yes, in the methods of Application.cfc, you need to specify the scope,
including the Application scope. For Application attributes
(sessiontimeout, name, etc), you can specify those in the THIS scope,
but
I had this question in a job interview once, 'which Application.cfc method
shares the variables scope with the rest of the application?'. I, of course,
said, 'none of them do, the variables scope is local to the application' and
they said that the correct answer was 'onRequest' - total hogwash.
4 matches
Mail list logo