Re: how can i check the session´s Auth for show html (login & logout)

2011-11-09 Thread WebbedIT
@Ogalov: The correct way to check if a user is logged in within the
view is:

$session->check('Auth.User.id');

The point is you are not wanting to read a value as you are not then
using the value, you simply want to check if it exists and perform
some other logic.  Jeremy gave you this answer and you decided to
modify your own solution (to something less flawed, but still flawed)
rather than use what he provided.  So my reply of

> Jeremy. thank for you answer.. (but I am going to ignore it)

Was FACT (with a hint of sarcasm), as I have seen a lot of people not
taking Jeremy's (and other's) advice of late.

It's great that you're learning CakePHP and we welcome you to the
group wholeheartedly, but when you ask for help and it is given try
using it.  It may not always work as those offering help can make
mistakes or misunderstand the question, but to ignore their answer and
continue to do your own thing is only going to increase the chances of
that person not helping you in the future.

HTH, Paul.

On Nov 8, 11:50 am, Ogalav  wrote:
> Jeremy, sorry but the Session->check no found it in the 'if else', i
> mean i use for read the user active that is all.
> i dont now why you say "rash of peaple doing it wrong"??? or what
> said webbedit !!! have i take it as sarcasm???..
>
> I'm reading a lot of cake and I'm no expert .. but I'm getting better
> every day.
>
> thank you very much for your answers
>
> regards
>
> WebbeDIT what mean... (but I am going to ignore it)
>
> On 8 nov, 09:48, Jeremy Burns | Class Outfit
>
>
>
>
>
>
>
>  wrote:
> > Lately there seems to be a rash of people doing it wrong, ignoring good 
> > advice and then continuing to have problems (aka "Cake is buggy/rubbish").
>
> > Jeremy Burns
> > Class Outfit
>
> >http://www.classoutfit.com
>
> > On 8 Nov 2011, at 08:39, WebbedIT wrote:
>
> > >> Jeremy. thank for you answer.. (but I am going to ignore it)
>
> > > You've got to laugh, Paul
>
> > > --
> > > Our newest site for the community: CakePHP Video 
> > > Tutorialshttp://tv.cakephp.org
> > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp 
> > > others with their CakePHP related questions.
>
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com 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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: how can i check the session´s Auth for show html (login & logout)

2011-11-08 Thread Ogalav

Jeremy, sorry but the Session->check no found it in the 'if else', i
mean i use for read the user active that is all.
i dont now why you say "rash of peaple doing it wrong"??? or what
said webbedit !!! have i take it as sarcasm???..

I'm reading a lot of cake and I'm no expert .. but I'm getting better
every day.

thank you very much for your answers

regards


WebbeDIT what mean... (but I am going to ignore it)


On 8 nov, 09:48, Jeremy Burns | Class Outfit
 wrote:
> Lately there seems to be a rash of people doing it wrong, ignoring good 
> advice and then continuing to have problems (aka "Cake is buggy/rubbish").
>
> Jeremy Burns
> Class Outfit
>
> http://www.classoutfit.com
>
> On 8 Nov 2011, at 08:39, WebbedIT wrote:
>
> >> Jeremy. thank for you answer.. (but I am going to ignore it)
>
> > You've got to laugh, Paul
>
> > --
> > 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
> > cake-php+unsubscr...@googlegroups.com 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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: how can i check the session´s Auth for show html (login & logout)

2011-11-08 Thread Jeremy Burns | Class Outfit
Lately there seems to be a rash of people doing it wrong, ignoring good advice 
and then continuing to have problems (aka "Cake is buggy/rubbish").

Jeremy Burns
Class Outfit

http://www.classoutfit.com

On 8 Nov 2011, at 08:39, WebbedIT wrote:

>> Jeremy. thank for you answer.. (but I am going to ignore it)
> 
> You've got to laugh, Paul
> 
> -- 
> 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
> cake-php+unsubscr...@googlegroups.com 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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: how can i check the session´s Auth for show html (login & logout)

2011-11-08 Thread WebbedIT
> Jeremy. thank for you answer.. (but I am going to ignore it)

You've got to laugh, Paul

-- 
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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: how can i check the session´s Auth for show html (login & logout)

2011-11-07 Thread Jeremy Burns | Class Outfit
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
>  wrote:
>> Instead of checking the session, do this:
>> 
>> 
>> Session->check('Auth.User')) {
>>  echo 'Logout';
>> } else {
>> echo 'Login';
>> }?>
>> 
>> 
>> 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
>>> 
>> 
>>>
>>>Session->read('Auth.User'))){
>>> echo 'Logout';
>>>}
>>>else {
>>> echo 'Login';
>>>}?>
>>>
>>> 
>>> --
>>> 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
>>> cake-php+unsubscr...@googlegroups.com 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
> cake-php+unsubscr...@googlegroups.com 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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: how can i check the session´s Auth for show html (login & logout)

2011-11-07 Thread Ogalav
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
 wrote:
> Instead of checking the session, do this:
>
> 
>         Session->check('Auth.User')) {
>                  echo 'Logout';
>         } else {
>                 echo 'Login';
>         }?>
> 
>
> 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
> > 
>
> >                    
> >                    Session->read('Auth.User'))){
> >                     echo 'Logout';
> >                    }
> >                    else {
> >                     echo 'Login';
> >                    }?>
> >                    
> > 
> > --
> > 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
> > cake-php+unsubscr...@googlegroups.com 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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: how can i check the session´s Auth for show html (login & logout)

2011-11-07 Thread Jeremy Burns | Class Outfit
Instead of checking the session, do this:


Session->check('Auth.User')) {
 echo 'Logout';
} else {
echo 'Login';
}?>



Jeremy Burns
Class Outfit

Tel: +44 (0) 208 123 3822
Mob: +44 (0) 7973 481949
Skype: jeremy_burns
http://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
> 
> 
>   
>   Session->read('Auth.User'))){
>echo 'Logout';
>   }
>   else {
>echo 'Login';
>   }?>
>   
> 
> --
> 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 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
> cake-php+unsubscr...@googlegroups.com 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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


how can i check the session´s Auth for show html (login & logout)

2011-11-07 Thread Ogalav
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



Session->read('Auth.User'))){
 echo 'Logout';
}
else {
 echo 'Login';
}?>


--
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 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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php