You're doing something wrong. If the user is not logged 
$this->Session->read('Auth.User') will fail. $this->Session ->check is the 
normal way to do it.

Jeremy Burns
Class Outfit

http://www.classoutfit.com

On 7 Nov 2011, at 15:32, Ogalav wrote:

> Jeremy. thank for you answer..
> 
> i did it like this and worked :
>                       $session_active = $this->Session->read('Auth.User');
>                       if (isset($session_active)){
>                        echo 'Logout';
>                       }
>                       else {
>                        echo 'Login';
>                       }
> 
> apparently PHP generate error (Can't use
> method return value in write context ) if i use function return value
> in context, so the evaluations  it place in one var "$session_active";
> and  session->check no found because only it prints logout and not
> check the conditional.
> 
> i´ll be investigate for session->check.
> 
> thantk for you help
> 
> regards ;)
> 
> 
> On 7 nov, 15:52, Jeremy Burns | Class Outfit
> <[email protected]> wrote:
>> Instead of checking the session, do this:
>> 
>> <h1>
>>         <? if ($this->Session->check('Auth.User')) {
>>                  echo 'Logout';
>>         } else {
>>                 echo 'Login';
>>         }?>
>> </h1>
>> 
>> Jeremy Burns
>> Class Outfit
>> 
>> Tel: +44 (0) 208 123 3822
>> Mob: +44 (0) 7973 481949
>> Skype: jeremy_burnshttp://www.classoutfit.com
>> 
>> Jeremy Burns
>> Class Outfit
>> 
>> http://www.classoutfit.com
>> 
>> On 7 Nov 2011, at 14:48, Ogalav wrote:
>> 
>>> Hi,
>> 
>>> i want show in the default.ctp in the header one content that will
>>> have link for logut or login, depending on the recording session
>>> active.
>>> so, i´m doing this:
>> 
>>> views/layouts/default.ctp
>>> <div id="header">
>> 
>>>                    <h1>
>>>                    <? if (isset($this->Session->read('Auth.User'))){
>>>                     echo 'Logout';
>>>                    }
>>>                    else {
>>>                     echo 'Login';
>>>                    }?>
>>>                    </h1>
>>> </div>
>>> ------------------------------------------
>>> and the users
>> 
>>> public function login() {
>> 
>>>            if ($this->Auth->login()) {
>>>                    $this->redirect($this->Auth->redirect(array('controller' 
>>> =>
>>> 'ordens', 'action' => 'orden')));
>> 
>>> }
>>> }
>> 
>>> but, can´t show it. it´s given to me the  Fatal error: Can't use
>>> method return value in write context
>> 
>>> thanks for you help
>> 
>>> --
>>> Our newest site for the community: CakePHP Video 
>>> Tutorialshttp://tv.cakephp.org
>>> Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help 
>>> others with their CakePHP related questions.
>> 
>>> To unsubscribe from this group, send email to
>>> [email protected] For more options, visit this group 
>>> athttp://groups.google.com/group/cake-php
> 
> -- 
> Our newest site for the community: CakePHP Video Tutorials 
> http://tv.cakephp.org 
> Check out the new CakePHP Questions site http://ask.cakephp.org and help 
> others with their CakePHP related questions.
> 
> 
> To unsubscribe from this group, send email to
> [email protected] For more options, visit this group at 
> http://groups.google.com/group/cake-php

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to