[Skip to content]

Search our Site
Easysite Resource Centre
Login/Logout Link

Login/Logout Link

Displays a customisable “Login” or “Logout” link, based on whether the current user is logged in or out. It could be used to replace a static “Login/Logout” link.

How to use this Style Element

In the style template, you would use the following code to include the link:

<%= StyleElement("LoginLogoutLink", "LoginLabel=Login;LogoutLabel=Logout;CssClass=myClass") %>

Configuration options are located as follows:

<%="StyleElement("LoginLogoutLink", "CONFIGURATION OPTIONS HERE") %>

The configuration options are defined as Name=Value pairs, separated by semi-colons, and all are optional:

LoginLabel

The label for the login link. Defaults to “Log In”

LogoutLabel

The label for the logout link. Defaults to “Log Out”.

This label can include the following tokens, which would be replaced at run-time with the current users data:

[USER_FIRST_NAME]

[USER_LAST_NAME]

[USER_FULL_NAME]

CssClass

The CSS class to be applied to the rendered HTML. Defaults to “loginlogoutlink”

LoginPage

The path to the login page. Defaults to the site default login page.

LogoutPage

The path to redirect to when logged out. Defaults to the current page path.

HTML

The rendered HTML for these links would be as follows (given the default configuration settings):

Login Link:

<span class="loginlogoutlink">
   <a title="Log In" class="loginlogoutlink-login" href="/login/">Log In</a>
</span>

Logout Link

<span class="loginlogoutlink">
   <a title="Log Out" class="loginlogoutlink-logout" href="?action=logout">Log Out</a>
</span>