Set Up An Infobox

Posted by ErichSteinboeck on 08 May 2008 19:35, last edited by GoVegan on 09 May 2010 06:00

Tags: conditional infobox optional

rating: +15+x

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:

[[/row]][!-- --]
[[/row]][!-- --]

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.


What you type … What you get …
 [[include infobox name=Its name
| playerYes=- | player=a player
| originYes=- | origin=The origin of this thing
Name: Its name
Player: a player
Origin: The origin of this thing
 [[include infobox name=Its name]]
Name: Its name


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



ErichSteinboeckErichSteinboeck. Please visit his/her userPage.

Related articles


Add a New Comment
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Share Alike 2.5 License.