How to Set Up an Infobox
Follow these steps, if you'd like to set up an infobox that displays only those attributes that have a value — all other attributes are omitted.
Step by Step
Create an infobox template where the code for all optional attributes (those that a user might want to exclude) is surrounded by
- “[!--{$attribYes}-]” (where attrib is any infobox attribute name) and
- “[!-- --]”,
for example:
[[table]]
[[row]]
[[cell]]**Name:**[[/cell]][[cell]]{$name}[[/cell]]
[[/row]]
[!--{$playerYes}-][[row]]
[[cell]]**Player:**[[/cell]][[cell]]{$player}[[/cell]]
[[/row]][!-- --]
[!--{$originYes}-][[row]]
[[cell]]**Origin:**[[/cell]][[cell]]{$origin}[[/cell]]
[[/row]][!-- --]
[[/table]]
Note:
The template should not contain any Wikidot comments ([!-- … --]) within the source code of an optional block (except the ones needed for the above structure)
On your including page, if you want to have an attribute appear, specify
attribYes=- | attrib=value-of-this-attribute
on the [[include infobox-template-name …]] tag.
Attributes that are not listed on the [[include …]] tag, are not displayed.
This also means, that you can at a later time change the infobox template (e. g. add another optional attribute) without breaking all existing includes.
Examples
| What you type … | What you get … | ||||||
|
|
||||||
|
|
Links
This is an application of the ideas presented in Include Part of a Page Only
There is also an alternative way to set up an Infobox — see Set Up an Infobox -- Exclude Specific Attributes
Backlinks
Author
ErichSteinboeck. Please visit his/her userPage.



