Sunday, May 3, 2009

Re: View Element - Unable to call him

On Sun, May 3, 2009 at 12:58 PM, AGD <anibaldamiao@gmail.com> wrote:
>
> Hi
>
> I created a element called 'user_navigation' and placed it in views/
> elements/user_navigation.ctp.I am now trying to call him but am unable
> to. I tried from the default layout page and from my home.ctp view,
> but no luck
> I'm trying to do this, according to the manual. If i change the name,
> i wont get any kind of error.
>
> <?php $this->element('user_navigation'); ?>

You're missing the echo.

> Also, i am trying to build a user menu, with welcome message,
> register, logout, account,... How can i check if the user is loggedin?
> (I am using the manual simple login creation steps, and everything
> works fine).

if ($session->read('Auth.User'))
{

If you're not using Auth:

if ($session->read('User'))

Just ensure that you're saving User to the session upon login:

$this->Session->write('User', $user)

--~--~---------~--~----~------------~-------~--~----~
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: