if($Session->read("User.id")) {
...
}

On Thu, Dec 24, 2009 at 8:30 AM, Edinei Luis Cipriani
<[email protected]> wrote:
> 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 [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
>
> 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 [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
>



-- 
Stefano Salvatori M.
http://stefano.salvatori.cl/

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 [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