How to check for login from template

7 months ago

Bill Lions
Member | 19

I have a menu link for login.
When the user is logged in, I wish to change this to the logout link.

Is this best done from the template, or set a status in the presenter and check the value of the status in the template?

7 months ago

David Matějka
Moderator | 5960

you can use $user variable, which is available in every template:

{if $user->isLoggedIn()}
    logout link
    login link