<vte:if>

Code inside <vte:if> is evaluated/printed if test condition is satisfied.

Required attribute is test.

vte:if tag can be parent of vte:else.

Attributes

test [{var1}|integer|'string'|”string”|true|false] [=|!=|&lt;|&gt;|in] [{var2}|integer|'string'|”string”|true|false]|[{var}]|[!{var}]

Children

<vte:else> (optional)

Example #1

<vte:if test="{var}">
    Var is evaluated as not empty (PHP treats boolean true, array with elements, 
    strings other than '', numbers other than 0, ... as not empty)
</vte:if>

Example #2

<vte:if test="!{var}">
    Var is evaluated as empty (PHP treats boolean false, array without elements, 
    string '', number 0, ... as empty), thus this message is printed.
</vte:if>

Example #3

<vte:if test="1 &lt; 2">
    1 is smaller than 2.
    <vte:else>
        1 is larger or equal than 2.
    </vte:else>
</vte:if>

Example #4

<vte:if test="2 in {array}">
    2 is a member of array.
</vte:if>

Example #5

<vte:if test="{tag.name} != ''">
    <li>
        <a href="{tag.get_href}">
            <span style="font-size:{tag.get_fontsize}px;">
                <vte:value select="{tag.name}" />
            </span>
        </a>
    </li>
</vte:if>
 
devdoc/vte/if.txt · Last modified: 2008/11/06 11:27 by milana
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki