How to check for login from template

about a year 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?

about a year ago

David Matějka
Moderator | 6161
+
+2
-

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

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