Thanks for your response.

(This app can only be accessed via an Apache auth module that sets
REMOTE_USER)

On Jan 2, 2:13 pm, euromark <dereurom...@googlemail.com> wrote:
> yes, you can use Configure::write()
> that's absolute fine, but try to set it in bootstrap.php if they are
> supposed to be global (side wide)
> that would be a cleaner approach than using some AppController method
> to do so.

Yes, I am trying to determine the earliest point in the process where
I can make these available.  I was able to define a USERAADDR constant
in bootstrap.php but had not tried Configure::Write there.  (Which I
will now do).

I tried to keep my initial post simple, but one complication is that I
also want to set anther global identifier that is kept in the
application's user/person table.  I am figure that I could just drop
some one-off SQL query code in bootstarp.php, but thought I would try
to do it the "Cake way" and so was trying to use existing model/
controller structure.

J

>
> On 2 Jan., 22:48, geste <jim.ho...@gmail.com> wrote:
>
>
>
> > All,
>
> > I am looking for the easiest, most global way to set a couple of app-
> > wide constants, more or less, that would derive from Apache variables,
> > specifically $_SERVER['REMOTE_USER'] and $_SERVER['REMOTE_ADDR'] and
> > that would be used throughout the app both in models and controllers.
>
> > A Configure:write method in app_controller.php seemed like it might be
> > the place to set like so:
>
> >   Configure::write('User.Address',$_SERVER['REMOTE_ADDR']);
>
> > but it looks like that method only wants text strings for the write
> > method and anyhow it did not work whether I tried it at top of
> > app_controller.php or in a beforeFilter function in
> > app_controller.php.
>
> > I also tried more generic means such as using PHP getenv like so:
>
> >  $ipaddr = getenv('REMOTE_ADDR');
>
> > and that partly works, but I am not seeing a way to make it glovally
> > available. Using the form
>
> >  var  $ipaddr = getenv('REMOTE_ADDR');
>
> > at top of app_controller.php just does not work, but I am guessing I
> > am misusing that "var" construct.
>
> > Any thoughts welcome!
>
> > J

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to