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

<logic:if> </...>

Defines a region which will show only if the supplied test evaluates to true.

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

Test if Current Page is the home page

HTML:

<logic:if test="\Components\Website\Pages::currentPageId() == '/'"> This is the home page </logic:if>

Test whether a variable (Current Page) has an icon.

HTML:

<logic:variable value="[? \Components\Website\Pages::current() ?]" as="page" /> <logic:if test="$page['page_icon']"> The Current Page has an Icon. </logic:if>

Using logical operators

HTML:

<logic:if test="(\Components\Website\Pages::currentPageId() == '/') || (\Components\Website\Pages::currentPageId() == '/about/')"> This is the home page or the about page. </logic:if> <logic:if test="(\Components\Website\Pages::currentPageId() == '/') && !(\Components\Customers\Contacts::currentIsLoggedIn())"> This is the home page, AND the current contact is NOT logged in. </logic:if>