Template:Infobox/doc

This is an example of classic infobox template - a simple infobox coded as table. It doesn't rely on another, basis template, like Template:Infobox with LUA coded Module:Infobox. It also uses styles set in Template:Classic infobox/styles.css (see Extension:TemplateStyles, otherwise can be set in MediaWiki CSS pages).

The code of this template and its styles can be copied and modified by anyone to any wiki.

Table
Infobox is a table. There is two ways to build tables on wiki spaces - using HTML mark up (tags) or using wiki mark up.

Here HTML tags were used:

Wiki mark up variant: For more information about wiki tables see: Help:Tables.

Parameters
In all templates parameters are placed in the code with triple curly braces:. Parameters can have a code name -, which can be placed in any order on actual page, as long as code names are written correctly. Without code names numbers should be used instead -, and on another page template will look at the order of values filled in it.

This example infobox has 5 parameters:

- it used to force custom text in a header of infobox
 * In the code it looks like this:
 * the use of  parser function means that parameter is optional and won't work if it's not filled
 * magic word in the function means that by default template uses title of the page it's used on

- for an image file
 * In the code:
 * once again means it's optional, but in this case there is no default value, in other words, if no image is provided there will nothing; otherwise function adds new row in the table, which will contain image
 * wiki mark up for images sets how image will be formatted inside infobox, in this case it has fixed width -, and align -  , but these values can be set up as another pair of parameters
 * only name of the file with format is needed

- caption under image
 * In the code:
 * - optional, without default value, otherwise adds new row in the table
 * there text formatting:  - for align, and   - to give italics to caption

- first actual data parameter, which has visible title in the infobox - "Parameter 1"
 * In the code:
 * it's very simple and there is no function - if left empty, infobox will show "Parameter 1" title, but there will be nothing to show in another column

- second data parameter, with "Parameter 2" title
 * In the code:
 * again means it's optional, but if filled it will add a row with two columns

Styles
The table uses styles which determinate its look. Here we have:
 * , most notably in the header
 * and several classes
 * for entire table - this wiki already has such class in Common.css page; most notably it puts the box into right side of the page and gives it background color and border
 * - for column with data titles; will be a custom class in Template:Classic infobox/styles.css page - for educational purposes it will brighter than usual Wikipedia style
 * - for second column, with data values; same as previous

Categories
With the aid of transclusion tags, infobox can place the page it's used on into a category (or several categories).

In case of this template, code: placed inside  tag, will add the page into "Some category", unless the namespace of that page is "template" - hence "do nothing" commentary bit.

Usage
To use infobox on another page, this code must be used: Per break down above, the only obligatory parameter here.

If everything is left empty, the output will be:

Code of filled up example:

Gives: