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

Reply via email to