Help:Conditional tables
Appearance
The {{qif}} template (as well as a number of other templates which directly or indirectly rely on the methods used in qif) allows for conditional display of rows in table rows, columns or cells. The method is fairly straightforward, but has some limitations which are worth explanation.
Basic use
The following example shows a basic use for {{qif}}–
{{qif |test={{{variable_foo|}}} |then=foo is set to '''{{{variable_foo}}}''' |else=foo is ''blank''}}
Here, the {{{variable_foo}}}
is checked to see if it is defined with a non-blank value. The table below shows the output from a template call (we'll call the template {{qif_example_1}}) with different values for {{{variable_foo}}}
–
Template call | Result |
---|---|
{{qif_example_1}} | foo is blank |
{{qif_example_1|variable_foo=}}
|
foo is blank |
{{qif_example_1|variable_foo=value}}
|
foo is set to value |