ZPT-JS tutorial - Conditionals

Simple conditionals

Sometimes we want to show some HTML elements depending on a condition. This can be done using data-condition attribute. Using it the element and its content will be shown only if the condition is evaluated to true. Let's see an example:

sample.html
<p data-condition="user/isLogged()">
    ...
</p>
                

ZPT-JS evaluates the user/isLogged() expression: only if it evaluated to true the p tag will be shown. Otherwise it will be hidden.

But... when does an expression evaluate to true? If an expression evaluates to any of the next:

the expression evaluates to false. Otherwise the expression evaluates to true.