Logical Tags
Some tags within the tag library can be used to make logical evaluations. For example, you might test if the user has administrative privileges or if the user is logged in. Based on the results of this test, you may or may not display some additional content.
For example, if a user is logged in, you want to display a logout link. If a user is not logged in, you may want to display a login link.
The following snippet shows these tags being used:
<!-- If the user is logged in, display a logout link. -->
<lcui:test key="loggedin">
<lcui:link url="session.xql?action=logout&redirect=1" value="login.logout"/>
</lcui:test>
<!-- If the user is not logged in, display a login link. -->
<lcui:test key="notloggedin">
<lcui:link url="ui.xql?action=html&resource=login.html" value="login.title"/>
</lcui:test>
<!-- If the user has admin permissions ("Manage application"), display an Administration link. -->
<lcui:test key="admin">
<lcui:link url="admin.xql?action=home" value="admn.title"/>
</lcui:test>
| Tag | Description | Parameters |
|---|---|---|
Named Test |
Unlike most other tags in the tag library, the named test tag is meant to have content within it. If you wanted to place a link on the page only in certain circumstances, you should wrap it in a When using the named test tag, you should store the value of the template call into a variable. The variable will contain "TRUE" if the test returned true, or "FALSE" otherwise. |
|
Check Variable |
If the variable defined in the |
|