TConditional
API Manual
TConditional displays appropriate content based on the evaluation result
of a PHP expression specified via Condition.
If the result is true, it instantiates the template TrueTemplate;
otherwise, the template FalseTemplate is instantiated.
The PHP expression is evaluated right before the onInit stage of the control lifecycle.
Since TConditional evaluates Condition at a very early stage, it is recommended
you set Condition in template only and the expression should not refer to
objects that are available on or after the onInit lifecycle.
TConditional is very light. It instantiates either TrueTemplate
FalseTemplate, but never both. And the condition is evaluated only once.
A typical usage of TConditional is shown as following:
<com:TConditional Condition="$this->User->IsGuest">
<prop:TrueTemplate>
<a href="path/to/login">Login</a>
</prop:TrueTemplate>
<prop:FalseTemplate>
<a href="path/to/logout">Logout</a>
</prop:FalseTemplate>
</com:TConditional>