Template:Infobox v2/doc

This is a documentation page. Meta-template used for constructing infobox templates. Infoboxes are fixed-format tables designed to be added to the top right-hand corner of articles to consistently present a summary of the article content.

Up to 50 rows in as many groups with up to 4 columns each are supported. Every row can have a varying number of columns and groups can be made collapsible. Specific conditions can be specified for each row. In addition, the template supports up to 5 images in the main image area and dynamically calculates the appropriate width/height for each image.

Note that version 2 differs significantly from version 1 in that you can currently only have one infobox v2 per page. However, in exchange, infobox v2 currently supports up to 50 rows (10 more than v1).

The number of rows and number of infoboxes supported on a page can be easily changed by a member of staff, so don't hesitate to ask if you encounter a problem (for details see, maxRows).

Usage
Most of the parameters should usually be passed down from the "end" infoboxes (i.e. the ones directly used in articles).

General explanations

 * A given row can contain either a, an   or   and   cells; these 3 options are mutually exclusive. For example, if you specify  ,   and  , only   will be shown. Order of priority:   >   >   >.
 * The layout for each row is generated automatically based on which cells are specified in the row itself and in the group it belongs to. It is possible to have rows with different column counts within the same group; the cells in the row with less columns will then span multiple columns, depending on exactly which columns are used in this row. For example, if one row in a given group has 4 columns and another has only 2, the layout of the second row will vary depending on which columns are used:
 * If the first and the last cell are used, the first cell (of the second row) will span columns 1, 2 and 3 (of the first row).
 * If the first and the second cell were used, the second cell will span columns 2, 3 and 4.
 * If the first and the third cell were used, the first cell will span columns 1 and 2 while the second cell will span columns 3 and 4.

Parameters
Terms used in the parameter descriptions:
 * |example = value Defined and not empty: A parameter is "defined and not empty" if it has been set to any value. In the example on the right, the parameter  is defined and not empty.
 * |example = Defined and empty: A parameter is "defined and empty" if it is present on the page but has been set to no value. In the example on the right, the parameter  is defined and empty.
 *  Defined and not empty: A parameter is "undefined" if it is not present on the page. In the example on the right, the parameter  is undefined.
 * |example = @word Magic word: Magic words are terms which - when set as a parameter value - have a special effect. They are usually prefixed with an "@" in order to differentiate them from normal parameter values. In the example on the right, the parameter  is set to the magic word "@word".

Style parameters
All  options should be used sparingly as they can lead to visual inconsistencies. Some examples of useful styles:
 * Changing background color:  (accepts HTML color names or RGB hex triplets)
 * Changing (horizontal) text-alignment:  (accepts "center", "justify", "left", "right")
 * Changing vertical text-alignment:  (accepts "bottom", "middle", "top")

Simple


Infobox with groups


Infobox with multiple columns


Infobox with collapsible groups


Infobox with collapsible and non-collapsible groups


Infobox with multiple main images


Infobox with all main images in one row


Copy/paste


Technical

 * This template is fairly complicated. Editing it requires a good understanding of parser functions and wiki syntax, or good general programming knowledge.
 * Auxiliary templates:


 * Infobox/aux: Generates a "content"/"label" row.
 * Infobox/aux2: Generates "group" tables and header rows.
 * Infobox/aux3: Generates an "image" row.
 * Extensions used:
 * ImageSizeInfoFunctions
 * Variables
 * Loops
 * Standardized documentation for templates based on this one:
 * Infobox/doc/standard

Variables
In all of these variable names, N is a placeholder for a number between 1 and maxRows. As an example, ibRNLay can be ibR4Lay, ibR5Lay, ibR24Lay, and so on. X is used as a placeholder for a group number. This can be any arbitrary integer. It is different from the row number, and every row also has a group number.

maxRows
 * A simple integer representing an arbitary max number of loop iterations. This sets the number of rows supported by this template, so increasing this will allow for more than 50 rows in the infobox. Currently this is defined separately in two places, mainly because I'm lazy (LunaShroom (talk) 09:27, 10 September 2017 (UTC)), but if they differ, this template will break! It is probably worth moving these two definitions into a header of some sort if you are actually planning on editing this template in the future.
 * Note that the current value of 50 is used because the current maxLoops is 100 (the default), and this template needs two separate loops to function in its current form (if you're a real algo-wizard and/or you don't mind making the logic even more incomprehensible than it already is, feel free to try and rewrite this). To increase this value, you also need to increase the configuration variable ExtLoops::$maxLoops in LocalSettings.php to double the number of desired rows (due to the 2 loops in this template).

ibCurRow - Name expanded: "Info-box Current Row"
 * A simple integer between 1 and maxRows representing which row is currently being generated by the parser.

ibRNLay - "Info-box Row N Layout"
 * This is a comma-delimited string representing the layout of the row. This can be a single value, such as "group", or a set of values representing the 4 possible columns, e.g. "label,content,0,0," or "content,content,0,0,"

ibCurGrp - "Infobox Current Group"
 * This is a variable keeping track of the current group assignment. This is carried between rows, so that each row is given the same group assignment as the row above it.
 * This continues until the current row is a group itself. Then ibCurGrp is set to the value of ibCurRow (the current row number), and the loop continues from there.
 * Note that this behaviour necessitates that the variable-setting loop is executed in forward order, i.e. the same order as the rows would be displayed in the table.

ibRNGrp - "Infobox Row N Group"
 * The group which row N is assigned to. This is a simple integer, representing the row number of the start/header of this group.
 * Note this is discontinuous, so it doesn't go group 1, 2, 3 . As it is the header of the group, it can easily go group 1, 1 ,1 ,4 ,4 ,5 ,5 ,5 ,5, etcetera.

ibGXShow - "Infobox Group X Show"
 * Whether or not group X should be shown or not. Blank if false, 1 if true.
 * This is set by the pre-content-printing variable loop.


 * This needs to happen before the main content loop because it uses forward-dependant definitions. A group is only shown if at least one of its rows is shown, necessitating doing the lower rows' calculations before the group header can decide if it's shown (the group header being a row which is above the content rows).