Thursday, December 24, 2009

Re: Logout link in layout

If(isset($this->Session->read('User.id'))):
> echo $html->link('Logout', array('controller' => 'Users',
> 'action'=>'logout'));

endif;

happy christmas


Em 24/12/2009, às 07:46, emmexx escreveu:

> I'd like to put a logout link in my default layout. The link should be
> there only when a user has already logged in.
> I put the following code in my app/views/layouts/default.ctp:
>
> if ($this->Auth->user())
> echo $html->link('Logout', array('controller' => 'Users',
> 'action'=>'logout'));
>
> but, of course, cake didn't like and screamed in horror:
>
> Notice (8): Undefined property: View::$Auth [APP/views/elements/
> logout.ctp, line 3]
>
> Fatal error: Call to a member function user() on a non-object in /app/
> views/elements/logout.ctp on line 3
>
> Is there a way to accomplish that?
>
> Thank you and Merry Christmas!
>
> maxx
>
> Check out the new CakePHP Questions site http://cakeqs.org and help
> others with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google
> Groups "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscribe@googlegroups.com For more options, visit this
> group at http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: