Template:Infobox Conditionals

From Wikipedia, the free encyclopedia

{{{name}}}
[[Image:{{{image}}}|300px| ]]
{{{caption}}}
Data 1: {{{data1}}}
Data 2: this text displayed if data2 not defined
Data 3 (data hidden if data3 empty or not defined):

In this template, the 4th and 5th rows are hidden using ParserFunctions if the variable {{{data4}}} and {{{data5}}} are empty.


[edit] Usage

Copy this code

{| class="infobox bordered" style="width: 25em; text-align: left; font-size: 95%;"
|+ style="font-size: larger;" | '''{{{name}}}'''
|-
| colspan="2" style="text-align:center;" | [[Image:{{{image}}}|300px| ]]<br>{{{caption}}}
|- 
! Data 1:
| {{{data1}}}
|- 
! Data 2:
| {{{data2|''this text displayed if data2 not defined''}}}
|- 
! Data 3 (data hidden if data3 empty or not defined):
| {{{data3|}}}
|- {{#if:{{{data4|}}}|
! Data 4 (row hidden by #if: if data4 empty):
<td>{{{data4}}} }}
|- {{#if:{{{na{{{data5|}}}me|}}}|
! Data 5 (row hidden by #if: if name exists and data5 not empty):
<td>{{{data5}}} }}
|- 
| colspan="2" style="font-size: smaller;" | {{{footnotes|}}}
|}

[edit] See also