It looks like you're using simple values but remember complex values are
pass by reference:
<cfset application.testVar = "Simple Value" />
<cfset localVariable = application.testVar />
<cfset application.testVar = "A Different Simple Value" />
<cfoutput>
Simple Values are Passed by Value:
<br/>
localVariable = #localVariable#
<br/>
Is different than:
<br/>
application.testVar = #application.testVar#
</cfoutput>
<hr/>
<cfset application.testVar = structNew() />
<cfset structInsert(application.testVar, "aKey", "A Value") />
<cfset localVariable = application.testVar />
<cfset structInsert(application.testVar, "aKey", "A Different Value",
true) />
<cfoutput>
Complex Values are Passed by Reference:
<br/>
<cfdump var = "#localVariable#" label = "localVariable" />
<br/>
Is THE SAME as:
<br/>
<cfdump var = "#application.testVar#" label = "application.testVar" />
</cfoutput>
On 11/21/11 1:21 PM, Robert Harrison wrote:
> Thanks. I know I didn't need the ##... just thought it helped make it more
> clear what I was doing in the email.
>
> And yes, I tested this and it does seem to work.
>
> Thanks
>
> Robert B. Harrison
> Director of Interactive Services
> Austin& Williams
> 125 Kennedy Drive, Suite 100
> Hauppauge NY 11788
> P : 631.231.6600 Ext. 119
> F : 631.434.7022
> http://www.austin-williams.com
>
> Great advertising can't be either/or. It must be&.
>
> Plug in to our blog: A&W Unplugged
> http://www.austin-williams.com/unplugged
>
>
> -----Original Message-----
> From: .jonah [mailto:[email protected]]
> Sent: Monday, November 21, 2011 4:20 PM
> To: cf-talk
> Subject: Re: application vars
>
>
> That would work just fine.
>
> Note that you don't need the "##" when assigning variables like that.
>
> <cfset thepagevar = application.mystandardvar /> will do.
>
>
>
> On 11/21/11 1:15 PM, Robert Harrison wrote:
>> Ok. So if I want to create a global var that's almost always the same (with
>> a few exceptions), I could do the following in the application.cfc:
>>
>> Set up the application vars I always want available.
>>
>> <cffunction
>> name="OnApplicationStart"access="public"returntype="boolean" output="false"
>> hint="Fires when the application is first created.">
>> <cfset application.mystandardvar = "foo">
>> <cfset application. myoverridevar = "kungfoo">
>> </cffunction>
>>
>> Set up the most standard use like below (which should make it available on
>> all pages):
>>
>> <cffunction name="OnRequestStart" access="public" returntype="string"
>> output="true" hint="Fires at first part of page processing.">
>> <cfset thepagevar="#application.mystandardvar#">
>> </cffunction>
>>
>> Then, on the exception pages where I want to use the other variant, I can do
>> the following at page top:
>>
>> <cfset thepagevar="="#application.myoverridevar#">
>>
>>
>> This will make all occurrences of "thepagevar" the same as
>> application.mystandardvar, except on those pages where I did the additional
>> cfset at page top, in which case it will be application. Myoverridevar for
>> that page only.
>>
>> Does this look correct?
>>
>> Thanks
>>
>> Robert B. Harrison
>> Director of Interactive Services
>> Austin& Williams
>> 125 Kennedy Drive, Suite 100
>> Hauppauge NY 11788
>> P : 631.231.6600 Ext. 119
>> F : 631.434.7022
>> http://www.austin-williams.com
>>
>> Great advertising can't be either/or. It must be&.
>>
>> Plug in to our blog: A&W Unplugged
>> http://www.austin-williams.com/unplugge
>>
>>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:348839
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm