Brian, good idea.  I'll give that a shot.  I "assumed" that putting them
in the VARIABLES scope would have ensured they were visible inside any
other page that included them.  App.cfc must not follow that rule.

M!ke 

-----Original Message-----
From: Brian Kotek [mailto:[EMAIL PROTECTED] 
Sent: Friday, July 27, 2007 12:07 AM
To: CF-Talk
Subject: Re: Chicken or Egg? Config File to Set Application Variables

When I test this I can reference the variables in the included file as
long as the included file's variables don't specify the variables scope
(which I assume forces them to be local to the included template). So
just do:

Config.cfm
----------
<cfset constants.sessionTimeout = createTimeSpan(0,0,1,0)> <cfset
constants.applicationTimeout = createTimeSpan(0,0,2,0)>

And reference them as variables.constants.sessionTimeout in the
Application.cfc.


On 7/26/07, Michael Dawson <[EMAIL PROTECTED]> wrote:
>
> I can use relative references, however, there appears to be a bug in 
> CF8 that won't allow you include a file in the Application.cfc's
"constructor"
> area.  Well, that's not entirely correct.  You can include a file, 
> however, you can't refer to any variables within that included file.  
> That makes it pretty useless.
>
> What I want to do is very basic:
>
> I want an Application.cfc that is exactly the same for development, 
> testing and production.  I want that Application.cfc to get its 
> settings from a Config file that is unique to each site (development, 
> testing and production).
>
> Here is a requirement:
>
> I want to dynamically set the sessionTimeout and applicationTimeout 
> variables in the THIS scope.  I want to pull these values from a 
> config file located anywhere on the server (under the web root or
outside of it).
>
> Theoretically, it should work like this:
>
> Config.cfm
> ----------
> <cfset variables.constants.sessionTimeout = createTimeSpan(0,0,1,0)> 
> <cfset variables.constants.applicationTimeout = 
> createTimeSpan(0,0,2,0)>
>
>
> Application.cfc
> ---------------
> <cfcomponent>
>
>     <cfinclude template="../Config/Config.cfm">
>
>     <cfset this.sessionTimeout = variables.constants.sessionTimeout>
>     <cfset this.applicationTimeout =
> variables.constants.applicationTimeout>
>
> </cfcomponent>
>
>
> When running this simple code, the CFINCLUDE tag does not throw an 
> error, however, you can't refer to the variables set within the
included file.
>
> I would just like a solution to this simple problem.
>
> Thanks
> M!ke
>
> >> I have structured my web site (CF8) so that my config
> >
> >Use a relative reference to get to the parent directory or to 
> >siblings,
> etc.
> >Obviously, something will have to be hard-coded - the relative 
> >location
> of
> >the config file, or perhaps the name of the config file if you wanted

> >to mimic the behavior of CF when it's looking for
Application.cfc/cfm.
>
> 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Get the answers you are looking for on the ColdFusion Labs
Forum direct from active programmers and developers.
http://www.adobe.com/cfusion/webforums/forum/categories.cfm?forumid-72&catid=648

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:284723
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to