<logic:else>
AJAX
Data
Forms
Layout
Logic
ATTRIBUTES
EXAMPLES
Navigation
Personalisation
Standard
Templates
Regions
Third Party

<logic:else> </...>

Defines an alternate region to show when an If test fails. The Else tag must be defined as a sibling to an existing If tag. Contiguous Else tags with test conditions allow further conditions to be checked if the previous test fails.

Related Tutorials

Content

any
The content to show if the test condition is true.

Attributes

evaluateAt
string
Sets whether to evaluate the test during the render phase (when rendered) or when the object (and children) are being constructed

Note: Do not use when used for checking security (as child nodes may still be constructed and events processed)

Valid options: render, init
test
New
Sets the test for the statement

Tutorials

Examples

Else - Syntax

Use ELSE after an IF logic statement. Specify a block of code to be executed if a logic IF test failed.

HTML:

<logic:if test=""> If this logic test passes, this will render. </logic:if> <logic:else test=""> If the first logic test fails, but this second test passes, this will render. </logic:else> <logic:else> If neither of the above tests pass, this will render. </logic:else>

Show a different message when a contact is logged in.

HTML:

<logic:if test="\Components\Customers\Contacts::currentIsLoggedIn()"> Welcome Back! You're logged in. </logic:if> <logic:else> You're not logged in, click here to login. </logic:else>