I do such things like this:

in app_controller:

var $this->loggeduser=false;

function beforeFilter() {
if($this->loggeduser=$this->Session->read('User')) return;
.....
}
function beforeRender() {
$this->set("loggeduser",$this->loggeduser);
}

So I always have $this->loggeduser in every controller and $loggeduser
in every view.

It is the right way, I think.



On 10 мар, 14:38, mixersoft <[EMAIL PROTECTED]> wrote:
> I was going crazy always setting the current $user_id, $owner_id in my
> controller and then testing again for empty() in my views. So I put
> all my commonly used context variables into Session and wrote a
> controller function to keep it initialized and in sync with the
> controllers and views. (This might also be a good place to put random
> things like the current page # from paginate).
>
> Now in my view, I can just do something like:
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to