Thanks again. Sorry for any silly questions, but CFC's are something
I've neglected to wrap my head around and I really want to get it out
of the way.

In the case of my 'host' variable. I use it often, and I've decided
that it's best declared as a 'global' variable (in regards to
application.cfm) since I'd rather have it set from the beginning of
the app's instance.

I have no real issue with declaring it as application.host and
changing my code to use 'application.host' in place of just 'host'.
However, I'm curious if there's a way to declare my 'host' variable in
a way that will be used application wide, but without having to use
the variablename 'application.host'.

I tried the following, but I don't see 'host' in my dump

        <cffunction name="onRequestStart">
                <cfset host = "details.at">
        </cffunction>

Am I missing something?







On Thu, Jul 5, 2012 at 2:25 PM, Matthew Woodward <[email protected]> wrote:
> On Thu, Jul 5, 2012 at 12:03 PM, Jason King <[email protected]> wrote:
>>
>> In my application.cfm, I would declare my application, set the app
>> parameters, and setup any global variables I wanted.  For instance,
>> within Application.cfm I had the following
>>
>> <cfset host = "mydomain.com">
>
>
> That's only really global by virtue of the fact that Application.cfm
> executes on every request.
>
>>
>>
>> This way I could have #host# in all of my code instead of the actual
>> domain name (in case it changed). To my understanding, application.cfm
>> simply ran every time the page ran so it automatically declared the
>> 'host' variable.
>
>
> Right, you can still do this the same way if you put that line in the
> OnRequestStart method in Application.cfc.
>
>>
>>
>> Looking at some examples, do I need to declare my application as a
>> component now?
>
>
> I don't understand the question.
>
>>
>>
>> Here's what I've written so far.  This seems to be working, but I had
>> to add 'application.' to the front of the variables listed. (host,
>> etc).
>
>
> Not necessarily true depending on where you put things and what you want to
> do.
>
>>
>>
>> Do I just need to figure on going back and adding 'application.' as a
>> prefix to those variables I declared in application.cfm?
>
>
> Not necessarily, no. You may not want everything in your application scope.
>
>>
>>         <cfset this.clientmanagement = "yes">
>>         <cfset this.clientstorage = "cookie">
>
>
> Are you using client variables?
>
>>         <cffunction name="onApplicationStart">
>>                 <cfset application.imageMagickFolder = "c:\program
>> files\ImageMagick\">
>>                 <cfset application.showSiteAlert = 1>
>>                 <cfset application.host = "details.at">
>>                 <cfset application.adminID = 1>
>>         </cffunction>
>
>
> This *may* be fine and honestly is a better way to do it than your previous
> method if those are truly application-wide variables.
>
> --
> Matthew Woodward
> [email protected]
> http://blog.mattwoodward.com
> identi.ca / Twitter: @mpwoodward
>
> Please do not send me proprietary file formats such as Word, PowerPoint,
> etc. as attachments.
> http://www.gnu.org/philosophy/no-word-attachments.html
>
> --
> online documentation: http://openbd.org/manual/
> http://groups.google.com/group/openbd?hl=en

-- 
online documentation: http://openbd.org/manual/
 http://groups.google.com/group/openbd?hl=en

Reply via email to