How to check for login from template

3 months ago

Bill Lions
Member | 19
+
0
-

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?

3 months ago

David Matějka
Moderator | 5896
+
+2
-

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

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