Open main menu

Changes

Template:Infobox/doc

295 bytes added, 04:14, 25 January 2008
a section on optional fields
Note that if you want to insert an image elsewhere other than the top of the infobox, or insert other "freeform" data, using a row with just a "data" field allows for that sort of thing.
 
A row with a label but no data is not displayed. This allows for optional infobox contents. To make a field optional, use a parameter that defaults to an empty string, like so: <nowiki>data5={{{population|}}}</nowiki>
===Parameters===
;datastyle : Applies to all data cells
;belowstyle : Applies only to the below cell
 
===Making fields optional===
 
A row with a label but no data is not displayed. This allows for optional infobox contents. To make a field optional, use a parameter that defaults to an empty string, like so:
 
<pre>
|data5={{{population|}}}
</pre>
 
For more complex fields with preformatted contents that would still be present if a parameter was unset, you can wrap it all in a simple "if" statement to make the whole thing vanish when not used. Example:
 
<pre>
|data5= {{#if: {{{mass|}}} | {{{mass}}} kg}}
</pre>
===Examples===
Anonymous user