Good Solution, thanks!

-----Original Message-----
From: Brian Kotek [mailto:brian...@gmail.com] 
Sent: August-11-11 9:47 PM
To: cf-talk
Subject: Re: Setting client variable datasource via config.xml


Right, set up a function that you call to get the variables, and have it
read the XML the first time, and on any subsequent calls just use the XML
already loaded rather than load it again.


On Fri, Aug 12, 2011 at 12:17 AM, Matt Quackenbush
<quackfu...@gmail.com>wrote:

>
> No, you cannot do
>
> <cfset this.clientStorage = application.gs.clientVarDataSource />
>
> You might get away with that after the application has already been 
> init'd, but even then it would be a false positive and would stop 
> working as soon as the application timed out or the application server 
> was restarted.
>  However,
> you *can* do something like so:
>
> this.clientStorage = getClientStorageDatasource();
>
> function getClientStorageDatasource()
> {
>     // read your xml file and extract the variable
>     return theDatasource;
> }
>
> HTH
>
>
> On Thu, Aug 11, 2011 at 10:57 PM, Brook Davies <cft...@logiforms.com>
> wrote:
>
> >
> > But can you set this.clientstorage that way? Because It seems 
> > setting
> that
> > property within onRequestStart() does not work. In my requestStart 
> > method
> I
> > call another method which sets a client var. If I set the 
> > this.client[(storage|Management|etc] in the onRequestStart, I get an
> error
> > that the client scope is not enabled when I try to set a client var 
> > in a method called from there.
> >
> > Sorry to be using client variables Nathan :(
> >
> > Brook
> >
> > -----Original Message-----
> > From: Russ Michaels [mailto:r...@michaels.me.uk]
> > Sent: August-11-11 5:45 PM
> > To: cf-talk
> > Subject: Re: Setting client variable datasource via config.xml
> >
> >
> > I used to have this issue as well, you obviously cannot read read 
> > app
> vars
> > that do not exist yet and you cannot create them until the 
> > application scope is initialised.
> > The way I got round this is to have 2 XML files.
> > One that contains the init variables that need to exist before the 
> > application scope is initialised, and I load these into request 
> > scope onapplicationstart. Once this is done, I then load the global 
> > config into the application scope.
> >
> >
> >
> > On Thu, Aug 11, 2011 at 11:06 PM, Brook Davies 
> > <cft...@logiforms.com>
> > wrote:
> >
> > >
> > > I'm trying to set all my apps properties via a config file to make 
> > > deployment between dev, production servers easy. Problem is the 
> > > application vars that are read via onApplicationStart() are not 
> > > available within the opening part of the application.cfc and when 
> > > I try to set these properties inside onRequestStart() they do not
work.
> > > Should I be able to set these in onRequestsStart()?
> > >
> > >
> > >
> > > <cfcomponent output="false" extends="coldfireApplication">
> > >
> > >
> > >
> > >    <cfset this.clientManagement    = true>
> > >
> > >    <cfset this.setClientCookies    = true>
> > >
> > >    <cfset this.setDomainCookies    = false>
> > >
> > >    <cfset this.clientStorage       =
> application.gs.clientVarDataSource>
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> >
> >
> >
> >
>
> 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:346723
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to