views:

26

answers:

1

hello,

how can i use session variables in my controllers? do i need some specific helper, or component?

i need to use some of Auth defined variables, like

$session->read('Auth.User.user_type_id')

... etc.

tnx in adv!

+1  A: 

When using Sessions in your Controller, you can access this info via the Session Component. The component will setup the abstraction layer and make it available to the rest of the application. If you need to use the Session in your Views, you will also need to include the Session Helper.

The Auth component automatically uses the session if configured as such. You can see what is available in the Session data by using debug($this->Session->read());.

Michael
you're right! i just had to use ie. $this->Session->read('Auth.User.user_type_id');i love stackoverflow!

related questions