You cant set a variable within a function and expect it to be usable
again somewhere else. Variables defined in functions are restricted to
the functions scope. You have to set it to the object.
$this->display = $this->Session->read('Auth.User.display');
On Oct 15, 8:20 pm, "Dave Maharaj :: WidePixels.com"
<[email protected]> wrote:
> How can i access session data in beforeRender or before Filter?
>
> i have $display = $this->Session->read('Auth.User.display');
>
> and i have that all over the controller. Is there a way i can define that in
> a before function and access it from there instead of that long snip
> allover?
>
> I tried
>
> function beforeRender() {
>
> $display = $this->Session->read('Auth.User.display');
>
> }
>
> or
>
> function beforeFilter() {
>
> $display = $this->Session->read('Auth.User.display');
>
> }
>
> and in the controller $display comes up invalid variable
>
> Dave
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---