I do exactly that, Rick, and it works fine.  All my app vars are set in 
onApplicationStart, except for the constants like 'name', which I set 
outside the methods:



<cfcomponent output="false">
        
        <cfscript>
        this.name = "myAppName";
        this.applicationTimeout = createTimeSpan(0, 8, 0, 0);
        ...
        </cfscript>

        <cffunction name = "onApplicationStart">
                <cfset application.dsn= "myDatasource">
        </cffunction>

----------------------------------------

From: "Rick Faircloth" <r...@whitestonemedia.com>
Sent: Thursday, August 12, 2010 2:10 PM
To: "cf-talk" <cf-talk@houseoffusion.com>
Subject: Trying to understand application.cfc...

Ok...I worked with application.cfc's for awhile
and things seemed to work fine, but then I had some
issues and went back to old reliable application.cfm.

Now, however, I'd like to try again to get a grasp on
how to use application.cfc's.

First question:

Why can I set the application.website variable like this:

<cffunction name = "onRequestStart">

<cfset application.website = "RickFaircloth.com">

</cffunction>

But not like this:

<cffunction name = "onApplicationStart">

<cfset application.website = "RickFaircloth.com">

</cffunction>

???

OnApplicationStart would seem to be a more logical place
to set a global variable for an entire application than onRequestStart.

Rick



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336234
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to