|
|
Noel Conditionals
Noel provides a simple set of built-in conditional tags which
are used to select which content is parsed. The <IF> tag
can compare variable values (using == and !=) or evaluate the boolean value
of a variable. Any number of <ELSIF> sections can follow, optionally
an <ELSE> section, and conditionals are closed with an <END> tag.
<def foo=1 bar=1>
<if foo>A<end> <if foo==1>A<end> <if foo==$bar>A<end>
<if foo!=2>A<end>
<if !foo>X<end> <if foo==2>X<end> <if foo==bar>X<end>
<if foo==2>X<elsif bar==2>X<else>A<end>
A A A A A
|
There are also <IFTAG> and <ELSIFTAG> conditional tags that check
for the existence of a custom tag (given as a parameter).
IFTAG is true if the indicated custom tag both exists and is non-empty.
This allows logic to center around whether a tag has been defined and is
useful in higher-level templates, especially when combined with
'local' tags.
A simpler alternative to <IFTAG> is silent tag
notation if you only want to display the indicated tag if it is defined
and hide it if it is undefined.
|