Vorlage:Infobox/doc: Unterschied zwischen den Versionen

Aus wasteland.silverandsteel.de
Zur Navigation springen Zur Suche springen
nuka>Sakaratte
 
Template>Cedar101
K (→‎Examples: <source>, {{para}})
Zeile 1: Zeile 1:
<noinclude>{{Documentationpage}}</noinclude>
+
{{distinguish|Template:Userbox}}
Meta-template used for constructing [[:Category:Infobox templates|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.  
+
{{Documentation subpage}}
 +
<includeonly>{{#ifeq:{{#titleparts:{{PAGENAME}}|1|2}}|old ||{{High-use|3,000,000+}}{{Lua|Module:Infobox}}}}</includeonly>
 +
{{Parameter names example
 +
|name={{PAGENAME}} <!--|child |subbox |decat--> |title |above |subheader |subheader1 |subheader2={{{subheader2}}}<br/>......
 +
|image|caption |image1|caption1 |image2|caption2={{{caption2}}}<br/>......
 +
|header1=<div style="border-top:1px dashed #ccc;">{{{header1}}}<br/>{{nobold|( ''or'' )}}</div>
 +
|label2={{{label1}}} |data2={{{data1}}}
 +
|data3=( ''or'' ) |data4=<div style="padding-bottom:0.25em;border-bottom:1px dashed #ccc;">{{{data1}}}</div>
 +
|header5={{{header2}}}<br/><div style="padding:0.75em 0 0.5em;">{{nobold|( ''or'' )}}</div>
 +
|label6={{{label2}}} |data6={{{data2}}}
 +
|data7=( ''or'' ) |data8=<div style="padding-bottom:0.25em;border-bottom:1px dashed #ccc;">{{{data2}}}</div>
 +
|data9=<div style="padding:0.75em 0 0.5em;">( ''etc'' )</div>
 +
|below
 +
}}
  
Up to 44 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.
+
This template is intended as a meta template: a template used for constructing other templates. '''Note''': In general, it is not meant for use directly in an article, but can be used on a one-off basis if required. [[Help:Infobox]] contains an introduction about the recommended content and design of infoboxes; [[Wikipedia:Manual of Style/Infoboxes]] contains additional style guidelines. See [[WP:List of infoboxes]] and [[:Category:Infobox templates]] for lists of prepared topic-specific infoboxes.
  
==Usage==
+
== Usage ==
 +
{{tlf|Infobox}} is a meta-template: used to organise an actual <nowiki>{{Infobox sometopic}}</nowiki> template (like {{tl|Infobox building}}).
 +
 
 +
For <code><nowiki>[[Template:Infobox sometopic]]</nowiki></code>, template code then looks like this, simplified:
 
<pre>
 
<pre>
 
{{Infobox
 
{{Infobox
|games              ={{{games|}}}
+
| name    = {{{name|{{PAGENAME}}}}}
|title              ={{{name|}}}
+
| image    = {{{image|}}}
|subtitle          ={{{subtitle|}}}
+
| caption1 = {{{caption|}}}}}}
|supertitle        =example
+
 
|supertitle link    =examples
+
| label1   = Former names
|icon              ={{{icon|}}}
+
| data1  = {{{former_names|}}}
|main image1        ={{{image|}}}
+
 
|main image1 size   ={{{image size|}}}
+
| header2  = General information
|main image desc    ={{{image desc|}}}
+
 
|footer            ={{{footer|}}}
+
| label3  = Status
|group1            ={{{group1|}}}
+
| data3  = {{{status|}}}
|label1-1          ={{{label1|}}}
+
... <!-- etc. -->
|content1-2        ={{{content1|}}}
 
 
}}
 
}}
 
</pre>
 
</pre>
  
Most of the parameters should usually be passed down from the "end" infoboxes (i.e. the ones directly used in articles).
+
== Optional control parameters ==
 +
; name : If this parameter is present, "view/discuss/edit" links will be added to the bottom of the infobox, pointing to the named page. You may use the value <nowiki>{{subst:PAGENAME}}</nowiki>; however this is rarely what you want, because it will send users clicking these links in an infobox in an article to the template code rather than the data in the infobox that they probably want to change.
 +
; child :  See the [[#Embedding|Embedding]] section for details. If this is set to "yes", this child infobox should be titled but have no name parameter. This parameter is empty by default, set it to "yes" to activate it.
 +
; subbox :  See the [[#Subboxes|Subboxes]] section for details. If this is set to "yes", this subbox should be titled but have no name parameter. This parameter is empty by default, set to "yes" to activate it. It has no effect if the '''child''' parameter is also set to "yes".
 +
; decat : If this is set to "yes", the current page will not be autocategorized in a maintenance category when the generated infobox has some problems or no visible data section. Leave empty by default or set to "yes" to activate it.
 +
 
 +
== Content parameters ==
  
===General explanations===
+
=== Title ===
* A given row can contain either a <code>group</code>, an <code>image</code> ''or'' <code>content</code> and <code>label</code> cells; these 3 options are mutually exclusive. For example, if you specify <code>group1</code>, <code>image1</code> and <code>label1-1</code>, only <code>group1</code> will be shown. Order of priority: <code>group</code> > <code>image</code> > <code>label</code> > <code>content</code>.
+
There are two different ways to put a title on an infobox. One contains the title inside the infobox's border in the uppermost cell of the table, the other puts as a caption it on top of the table. You can use both of them together if you like, or just one or the other, or even neither (though this is not recommended):
* 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.<br/>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===
+
; title : Text to put in the caption over the top of the table (or as section header before the whole content of this table, if this is a child infobox). For [[Wikipedia:Manual of Style/Accessibility#Tables|accessibility reasons]], this is the most recommended alternative.
Terms used in the parameter descriptions:
+
; above : Text to put within the uppermost cell of the table.
* <pre style="clear: right; float: right; margin: 0 0 10px 5px; width: 150px;">|example = value</pre>''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 <code>example</code> is defined and not empty.
+
; subheader(n) : additional title fields which fit below {{{title}}} and {{{above}}}, but before images.
* <pre style="clear: right; float: right; margin: 0 0 10px 5px; width: 150px;">|example =</pre>''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 <code>example</code> is defined and empty.
 
* <pre style="clear: right; float: right; margin: 0 0 10px 5px; width: 150px;"> </pre>''Undefined'': A parameter is "undefined" if it is not present on the page. In the example on the right, the parameter <code>example</code> is undefined.
 
* <pre style="clear: right; float: right; margin: 0 0 10px 5px; width: 150px;">|example = @word</pre>''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 <code>example</code> is set to the magic word "@word".
 
  
 +
Examples:
  
{{Docparam|name=cond1 >> cond44|req=no|default=|desc=
+
{{Infobox
Condition for corresponding row. If a <code>cond</code> is defined and empty, the row is not shown. If a <code>cond</code> is defined and not empty, the row is shown. If a <code>cond</code> is undefined, the row is shown based on the default for its row type:
+
| name = Infobox/doc
* <code>group</code> rows: Only displayed if <code>group</code> is defined, not set to "@hide" and there are rows ''shown'' (not only specified) in the group.
+
| title      = Text in caption over infobox
* <code>image</code> rows: Only displayed if <code>image</code> is defined and not set to "@hide".
+
| subheader  = Subheader of the infobox
* <code>content</code>/<code>label</code> rows: If the row contains <code>content</code> cells, it is shown if at least one of the <code>content</code> cells is defined, not empty and not set to "@hide". If the row contains only <code>label</code> cells, it is shown if at least one of the <code>label</code> cells is defined, not empty and not set to "@hide".
+
| header = (the rest of the infobox goes here)
 +
}}
 +
<pre style="overflow:auto">
 +
{{Infobox
 +
| name = {{subst:PAGENAME}}
 +
| title      = Text in caption over infobox
 +
| subheader  = Subheader of the infobox
 +
| header = (the rest of the infobox goes here)
 
}}
 
}}
 +
</pre>{{clear}}
  
{{Docparam|name=colwidths|req=no|default=|desc=
+
{{Infobox
Column widths in percent, separated by commas (e.g. "50, 50"). Only applied to groups where the number of specified widths matches the number of columns in said group (e.g. if two widths are specified, only groups with two columns will be affected); for groups with more or less columns, the default widths are used.
+
| name = Infobox/doc
 +
| above      = Text in uppermost cell of infobox
 +
| subheader  = Subheader of the infobox
 +
| subheader2 = Second subheader of the infobox
 +
| header = (the rest of the infobox goes here)
 
}}
 
}}
 
+
<pre style="overflow:auto">
{{Docparam|name=colwidths0 >> colwidths44|req=no|default=|desc=
+
{{Infobox
Column widths in percent, separated by commas (e.g. "50, 50"). Only applied if the number of specified widths matches the number of columns in the group; otherwise <code>colwidths</code> (if that has a matching number of widths) or default widths are used. Overrides general <code>colwidths</code> parameter for the specific <code>group</code>.
+
| name = {{subst:PAGENAME}}
 +
| above      = Text in uppermost cell of infobox
 +
| subheader  = Subheader of the infobox
 +
| subheader2 = Second subheader of the infobox
 +
| header = (the rest of the infobox goes here)
 
}}
 
}}
 +
</pre>{{clear}}
  
{{Docparam|name=content1-1 ++ content1-2 ++ content1-3 ++ content1-4 >> content44-1 ++ content44-2 ++ content44-3 ++ content44-4|req=no|default=|desc=
+
=== Illustration images ===
Content of corresponding cell. The first number in the parameter name indicates the row and the second number stands for the column (numbered from left to right).
+
; image(n) : images to display at the top of the template. Use full image syntax, for example <nowiki>[[File:example.png|200px|alt=Example alt text]]</nowiki>. Image is centered by default. See [[WP:ALT]] for more on alt text.
 +
; caption(n) : Text to put underneath the images.
  
Magic words:
+
=== Main data ===
* ''@hide'': If all defined <code>content</code> cells in a row are set to "@hide", the row is not shown regardless of other conditions or options.
+
; header(n) : Text to use as a header in row n.
}}
+
; label(n) : Text to use as a label in row n.
 +
; data(n) : Text to display as data in row n.
  
{{Docparam|name=content1-1 tooltip >> content44-4 tooltip|req=no|default=|desc=
+
Note: for any given value for (n), not all combinations of parameters are permitted. The presence of a {{para|header''(n)''}} will cause the corresponding {{para|data''(n)''}} (and {{para|rowclass''(n)''}} {{para|label''(n)''}}, see below) to be ignored; the absence of a {{para|data''(n)''}} will cause the corresponding {{para|label''(n)''}} to be ignored. Valid combinations for any single row are:
Tooltip for corresponding cell, i.e. text which is displayed if a reader moves his/her mouse over the cell.
 
}}
 
  
{{Docparam|name=footer|req=no|default=|desc=
+
* {{para|class''(n)''}} {{para|header''(n)''}}
Text of the footer, i.e. a row at the very bottom of the infobox.
+
* {{para|rowclass''(n)''}} {{para|class''(n)''}} {{para|data''(n)''}}
}}
+
* {{para|rowclass''(n)''}} {{para|label''(n)''}} {{para|class''(n)''}} {{para|data''(n)''}}
  
{{Docparam|name=games|req=no|default=|desc=
+
See the rendering of header4, label4, and data4 in the [[#Examples|Examples]] section below.
Game abbreviation(s); for accepted abbreviations please see {{tl|abb}}. Multiple abbreviations can be specified if separated by comma (<code>,</code>). These are used to create dynamic links for <code>supertitle</code>. For usage details, please see <code>supertitle link</code> below.
 
}}
 
  
{{Docparam|name=group1 >> group44|req=no|default=|desc=
+
==== Number ranges ====
Content of corresponding cell, with the number indicating the row.
+
To allow flexibility when the layout of an infobox is changed, it may be helpful when developing an infobox to use non-contiguous numbers for header and label/data rows. Parameters for new rows can then be inserted in future without having to renumber existing parameters. For example:
  
Specifying a <code>group</code> row creates a new group (and a header), and all rows below it belong to that group until another <code>group</code> field is specified. For example, if you set <code>group1</code>, <code>content2-1</code>, <code>image3</code>, <code>group4</code> and <code>label5-1</code>, row 2 & row 3 belong to group 1 and row 5 belongs to group 4.
+
<pre style="overflow:auto">
 +
| header3  = Section 1
 +
label5 = Label A
 +
|  data5  = Data A
 +
|  label7  = Label C
 +
|  data7  = Data C
 +
| header10 = Section 2
 +
|  label12 = Label D
 +
|  data12 = Data D
 +
</pre>{{clear}}
  
All rows above the first specified <code>group</code> belong to group 0. For example, if you set <code>image1</code>, <code>content2-1</code>, <code>image3</code>, <code>group4</code> and <code>label5-1</code>, row 2 & row 3 belong to group 0 and row 5 belongs to group 4.
+
It is also possible to automatically renumber parameter names by using [[User:Frietjes/infoboxgap.js]] or [[Module:IncrementParams]].
  
Magic words:
+
==== Making data fields optional ====
* ''@hide'': Creates a group without a visible header.
+
A row with a label but no data is not displayed. This allows for the easy creation of optional infobox content rows. To make a row optional use a parameter that defaults to an empty string, like so:
}}
 
  
{{Docparam|name=icon|req=no|default=|desc=
+
<pre style="overflow:auto">
File name of icon (without "File:"), i.e. the small image which is displayed in the top right corner of the main image area.
+
| label5 = Population
}}
+
|   data5 = {{{population|}}}
 +
</pre>{{clear}}
  
{{Docparam|name=icon offset|req=no|default=0px|desc=
+
This way if an article doesn't define the population parameter in its infobox the row won't be displayed.
Offset for <code>icon</code> in [[wikipedia:Pixel|pixels]], i.e. the icon is moved "upwards" by the specified amount of pixels. The maximum value is "<code>icon size</code>-specified height + 5".  
 
  
Magic words:
+
For more complex fields with pre-formatted contents that would still be present even if the parameter wasn't set, you can wrap it all in an "#if" statement to make the whole thing vanish when the parameter is not used. For instance, the "#if" statement in the following example reads "#if:the parameter ''mass'' has been supplied |then display it, followed by 'kg'":
* ''@outside:'' Icon is placed completely outside (above) the <code>main image</code> area.
 
}}
 
  
{{Docparam|name=icon size|req=no|default=30x30px|desc=
+
<pre style="overflow:auto">
Size of <code>icon</code> in [[wikipedia:Pixel|pixels]]. If no height/width is specified or the specified value exceeds the limit of 40px, the default icon height/width is used.
+
| label6 = Mass
}}
+
|   data6 = {{ #if: {{{mass|}}} | {{{mass}}} kg }}
 +
</pre>{{clear}}
  
{{Docparam|name=image1 >> image44|req=no|default=|desc=
+
For more on #if, see [[meta:ParserFunctions##if:|here]].
File name of image (without "File:") to be displayed in corresponding cell, with the number indicating the row. If an <code>image</code> has been specified but has not been filled in, an "upload image" button will be displayed instead, prompting users to upload an image with a pre-defined file name (see <code>image# default</code>).
 
  
Magic words:
+
==== Hiding headers when all data fields are hidden ====
* ''@hide'': Hides the image (or "upload image" button) regardless of other conditions or options.
+
You can also make headers optional in a similar way. Consider this example:
 +
{{Infobox
 +
| title  = Example of an undesirable header
 +
| header1 = Undesirable header
 +
|  label2 = Item 1      |  data2 =
 +
|  label3 = Item 2      |  data3 =
 +
|  label4 = Item 3      |  data4 =
 +
| header5 = Static header
 +
|  label6 = Static item |  data6 = Static value
 +
}}
 +
<pre style="overflow:auto">
 +
{{Infobox
 +
| title  = Example of an undesirable header
 +
| header1 = Undesirable header
 +
|  label2 = Item 1      |  data2 =
 +
|  label3 = Item 2      |  data3 =
 +
|  label4 = Item 3      |  data4 =
 +
| header5 = Static header
 +
|  label6 = Static item |  data6 = Static value
 
}}
 
}}
 +
</pre>{{clear}}
  
{{Docparam|name=image1 default >> image44 default|req=no|default=<nowiki>{{PAGENAME}}</nowiki> #.jpg|desc=
+
If you want the first header to appear only if one or more of the data fields that fall under it are filled, one could use the following pattern as an example of how to do it:
The file name (without "File:") which is suggested when uploading an image via the "upload image" button in the corresponding cell. It is recommended to make this depend on <nowiki>{{PAGENAME}}</nowiki>.
 
}}
 
  
{{Docparam|name=image1 desc >> image44 desc|req=no|default=|desc=
+
{{Infobox
Description for the corresponding <code>image</code>, displayed below the image.
+
| title  = Example of an optional header
 +
| header1 = {{ #if: {{{item1|}}}{{{item2|}}}{{{item3|}}} | Optional header }}
 +
| label2 = Item 1      |   data2 = {{{item1|}}}
 +
|  label3 = Item 2      |   data3 = {{{item2|}}}
 +
|  label4 = Item 3      |  data4 = {{{item3|}}}
 +
| header5 = Static header
 +
|  label6 = Static item |  data6 = Static value
 
}}
 
}}
 
+
<source lang="moin" style="overflow:auto">
{{Docparam|name=image1 size >> image44 size|req=no|default=|desc=
+
{{Infobox
Size for corresponding <code>image</code> in [[wikipedia:Pixel|pixels]]. If the width of the image exceeds infobox <code>width</code>, the default width is used instead.
+
| title  = Example of an optional header
 +
| header1 = {{ #if: {{{item1|}}}{{{item2|}}}{{{item3|}}} | Optional header }}
 +
|  label2 = Item 1      |  data2 = {{{item1|}}}
 +
|  label3 = Item 2      |  data3 = {{{item2|}}}
 +
| label4 = Item 3      |   data4 = {{{item3|}}}
 +
| header5 = Static header
 +
|  label6 = Static item |   data6 = Static value
 
}}
 
}}
 +
</source>{{clear}}
  
{{Docparam|name=label1-1 ++ label1-2 ++ label1-3 ++ label1-4 >> label44-1 ++ label44-2 ++ label44-3 ++ label44-4|req=no|default=|desc=
+
header1 will be shown if any of item1, item2, or item3 is defined. If none of the three parameters are defined the header won't be shown and no empty row appears before the next static content. The trick to this is that the <code>#if</code> returns false only if there is nothing whatsoever in the conditional section, so only if all three of item1, item2 and item3 are undefined will the if statement fail.
Content of corresponding cell. The first number in the parameter name indicates the row and the second number stands for the column (numbered from left to right).
 
  
Magic words:
+
Note that such trick may be sometimes very complex to test if there are many data items whose value depends on complex tests (or when a data row is generated by a recursive invokation of this template as a [[#Subboxes|subbox]]). Ideally, the Lua module supporting this template should now support a new way to make each header row autohideable by detecting if there is at least one non-empty data row after that header row (a parameter like {{para|autohide header1 | yes}}, for example, would remove the need to perform the <code>#if</code> test so that we can just to define {{para|header1 | Optional header}}),
* ''@hide:'' If there are only <code>label</code> cells defined in a given row and all of these are set to "@hide", the row is not shown regardless of other conditions or options.
 
}}
 
  
{{Docparam|name=label1-1 tooltip >> label44-4 tooltip|req=no|default=|desc=
+
=== Footer ===
Tooltip for corresponding cell, i.e. text which is displayed when a reader moves his/her mouse over the cell.
+
; below : Text to put in the bottom cell. The bottom cell is intended for footnotes, see-also, and other such information.
}}
 
  
{{Docparam|name=main image columns|req=no|default=2|desc=
+
== Presentation parameters ==
Maximum amount of <code>main images</code> displayed per row. If the number of specified <code>main images</code> exceeds this value, a second (and if necessary, a third/fourth/fifth) row is created. For example, if <code>main image columns</code> is set to "3" and there are 2 <code>main images</code>, they will be displayed in one row; if there are 4 <code>main images</code>, the 4th image will be displayed in a second row.
 
}}
 
  
{{Docparam|name=main image default|req=no|default=<nowiki>{{PAGENAME}}</nowiki>.jpg|desc=
+
=== Italic titles ===
The file name (without "File:") which is suggested when uploading an image via the "upload image" button in the <code>main image</code> area. It is recommended to make this depend on <nowiki>{{PAGENAME}}</nowiki>.
+
Titles of articles with infoboxes may be made italic, in line with [[WP:ITALICTITLE]], by passing the <code>italic title</code> parameter.
}}
 
  
{{Docparam|name=main image desc|req=no|default=|desc=
+
* Turn on italic titles by passing {{para|italic title|<nowiki>{{{italic title|}}}</nowiki>}} from the infobox.
Description for the <code>main image</code> area, displayed below the images.
+
* Turn off by default (notably because only Latin script may be safely rendered in this style and italic may be needed to distinguish foreign language from local English language only in that script, but would be difficult to read for other scripts) but allow some instances to be made italic by passing {{para|italic title|<nowiki>{{{italic title|no}}}</nowiki>}}
}}
+
* Do not make any titles italic by not passing the parameter at all.
  
{{Docparam|name=main image1 >> main image5|req=no|default=|desc=
+
=== CSS styling ===
File name(s) of main image(s) (without "File:"), i.e. the images displayed directly below the infobox <code>title</code>. If more than one image is used, they are displayed in a configurable amount of rows (see <code>main image columns</code>) and their default sizes are adapted accordingly. If no <code>main image</code> has been specified, an "upload image" button will be displayed instead, prompting users to upload an image with a pre-defined file name (see <code>main image default</code>). <code>options</code> can be used to disable the "upload image" button.
+
; bodystyle : Applies to the infobox table as a whole
 +
; titlestyle : Applies only to the title caption. Adding a background color is usually inadvisable since the text is rendered "outside" the infobox.
 +
; abovestyle : Applies only to the "above" cell at the top. The default style has font-size:125%; since this cell is usually used for a title, if you want to use the above cell for regular-sized text include "font-size:100%;" in the abovestyle.
 +
; imagestyle : Applies to the cell the image is in. This includes the text of the image caption, but you should set text properties with captionstyle instead of imagestyle in case the caption is moved out of this cell in the future.
 +
; captionstyle : Applies to the text of the image caption.
 +
; rowstyle(n) : This parameter is inserted into the <code>style</code> attribute for the specified row.
 +
; headerstyle : Applies to all header cells
 +
; labelstyle : Applies to all label cells
 +
; datastyle : Applies to all data cells
 +
; belowstyle : Applies only to the below cell
  
Magic words:
+
=== HTML classes and microformats ===
* ''@hide:'' If all defined <code>main image</code> parameters are set to "@hide", the main image area (or "upload image" button) is not shown regardless of other conditions or options.
+
; bodyclass : This parameter is inserted into the <code>class</code> attribute for the infobox as a whole.
}}
+
; titleclass : This parameter is inserted into the <code>class</code> attribute for the infobox's '''title''' caption.
 +
<!-- currently not implemented in Lua module
 +
; aboverowclass : This parameter is inserted into the <code>class</code> attribute for the complete table row the '''above''' cell is on.
 +
-->
 +
; aboveclass : This parameter is inserted into the <code>class</code> attribute for the infobox's '''above''' cell.
 +
; subheaderrowclass(n) : This parameter is inserted into the <code>class</code> attribute for the complete table row the '''subheader''' is on.
 +
; subheaderclass(n) : This parameter is inserted into the <code>class</code> attribute for the infobox's '''subheader'''.
 +
; imagerowclass(n) : These parameters are inserted into the <code>class</code> attribute for the complete table row their respective '''image''' is on.
 +
; imageclass : This parameter is inserted into the <code>class</code> attribute for the '''image'''.
 +
; rowclass(n) : This parameter is inserted into the <code>class</code> attribute for the specified row including the '''label''' and '''data''' cells.
 +
; class(n) : This parameter is inserted into the <code>class</code> attribute for the '''data''' cell of the specified row. If there's no '''data''' cell it has no effect.
 +
<!-- currently not implemented in Lua module
 +
; belowrowclass : This parameter is inserted into the <code>class</code> attribute for the complete table row the '''below''' cell is on.
 +
-->
 +
; belowclass : This parameter is inserted into the <code>class</code> attribute for the infobox's '''below''' cell.
  
{{Docparam|name=main image1 size >> main image5 size|req=no|default=<code>size main images</code>/number of images|desc=
+
This template supports the addition of microformat information. This is done by adding "class" attributes to various data cells, indicating what kind of information is contained within. Multiple class names may be specified, separated by spaces, some of them being used as selectors for custom styling according to a project policy or to the skin selected in user preferences, others beig used for microformats.
Size for corresponding <code>main image</code>. By default, this size depends on the number of specified <code>main images</code> and the amount of <code>main image columns</code>. If the combined width of all main images exceeds infobox <code>width</code>, images which are bigger than the default are reduced to default width.
 
}}
 
  
{{Docparam|name=options|req=no|default=|desc=
+
To flag an infobox as containing [[hCard]] information, for example, add the following parameter:
This parameter allows to specify options which apply to the infobox itself or all groups inside. Multiple options can be specified at once; simply separate them with commas (<code>,</code>).
 
  
Available choices:
+
<pre style="overflow:auto">
* ''collapsedgroups'': This makes all groups within the infobox collapsible and collapsed on page load. Can be overriden for individual groups by setting the group-specific <code>option</code> parameter (see below) to "uncollapsed".
+
| bodyclass = vcard
* ''collapsiblegroups'': This makes all groups within the infobox collapsible and uncollapsed on page load. Can be overriden for individual groups by setting the group-specific <code>option</code> parameter (see below) to "nocollapse".
+
</pre>{{clear}}
* ''imageoptional'': If set, having no <code>main image</code> specified will not result in an "upload image" button being displayed.
 
}}
 
  
{{Docparam|name=options0 >> options44|req=no|default=|desc=
+
And for each row containing a data cell that's part of the vcard, add a corresponding class parameter:
This parameter allows to specify options which apply to the corresponding group of rows. For example, <code>options4</code> applies to all cells which belong to <code>group4</code>. Multiple options can be specified at once; simply separate them with commas (<code>,</code>). Group-specific options override options set for the whole infobox.
 
  
Available choices:
+
<pre style="overflow:auto">
* ''collapsible'', ''nocollapse'', ''uncollapsed'': These options control the collapse behaviour of the group. They are mutually exclusive.
+
| class1 = fn
** ''collapsed'' means the group is collapsible and collapsed on page load.
+
| class2 = org
** ''collapsible''/''uncollapsed'' mean the group is collapsible and uncollapsed on page load.
+
| class3 = tel
** ''nocollapse'' means the group is not collapsible. This is the default setting.
+
</pre>{{clear}}
}}
 
  
{{Docparam|name=size images|req=no|default=(<code>width</code>-10) x (<code>width</code>-10)px|desc=
+
...and so forth. "above" and "title" can also be given classes, since these are usually used to display the name of the subject of the infobox.
Default size in [[wikipedia:Pixel|pixels]] for images in <code>image</code> rows. If the specified width exceeds infobox <code>width</code>, the default width is used instead; if no height is specified, the default height is used instead.
 
}}
 
  
{{Docparam|name=size main images|req=no|default=(<code>width</code>-10) x (<code>width</code>-10)px|desc=
+
See [[Wikipedia:WikiProject Microformats]] for more information on adding microformat information to Wikipedia, and [[microformat]] for more information on microformats in general.
Size of <code>main image</code> area in [[wikipedia:Pixel|pixels]], i.e. the total space available for all main images. This is used as basis for calculating the default width of the individual main images. If the specified width exceeds infobox <code>width</code>, the default width is used instead; if no height is specified, the default height is used instead.
 
  
<code>main image# size</code> overrides this default for the corresponding image.
+
== Examples ==
}}
+
Notice how the row doesn't appear in the displayed infobox when a '''label''' is defined without an accompanying '''data''' cell, and how all of them are displayed when a '''header''' is defined on the same row as a '''data''' cell. Also notice that '''subheaders''' are not bold by default like the '''headers''' used to split the main data section, because this role is meant to be for the '''above''' cell :
  
{{Docparam|name=sort by|req=no|default=|desc=
+
{{Infobox
Sets the term the page is sorted under when displayed in categories (<nowiki>{{DEFAULTSORT:}}</nowiki>).
+
|name         = Infobox/doc
}}
+
|bodystyle    =  
  
{{Docparam|name=subtitle|req=no|default=|desc=
+
|titlestyle  =  
Text in small font below infobox <code>title</code>.
+
|abovestyle  = background:#cfc;
}}
+
|subheaderstyle =
 +
|title        = Test Infobox
 +
|above        = Above text
 +
|subheader    = Subheader above image
 +
|subheader2  = Second subheader
  
{{Docparam|name=supertitle|req=no|default=|desc=
+
|imagestyle  =  
Text in small font above infobox <code>title</code>. Supertitles can be created dynamically by using the <code>games</code> parameter. For details, see <code>supertitle link</code> below.
+
|captionstyle =  
}}
+
|image        = [[File:Example-serious.jpg|200px|alt=Example alt text]]
 +
|caption      = Caption displayed below File:Example-serious.jpg
  
{{Docparam|name=supertitle link|req=no|default=|desc=
+
|headerstyle  = background:#ccf;
This parameter links the <code>supertitle</code> to an overview page (like [[Weapon]]). When used in conjunction with the <code>games</code> parameter, it can be used to dynamically create links to game-specific overview pages (like [[Fallout 3 weapons]]). For the exact behaviour please see {{tl|abblink}}.
+
|labelstyle  = background:#ddf;
 +
|datastyle    =  
  
This is useful if an infobox template is used for multiple games and you want it to link to the correct overview pages depending on which game it is used for. For example, setting <code>supertitle</code> to "weapon" and <code>supertitle link</code> to "weapons", you can then let the editor in the respective article specify the <code>games</code> parameter and it will link to the correct overview page (e.g. "Fallout 3 weapons" if the editor enters "FO3").
+
|header1 = Header defined alone
}}
+
| label1 =
 +
|  data1 =
 +
|header2 =
 +
| label2 = Label defined alone does not display (needs data, or is suppressed)
 +
|  data2 =
 +
|header3 =
 +
| label3 =
 +
|  data3 = Data defined alone
 +
|header4 = All three defined (header, label, data, all with same number)
 +
| label4 = does not display (same number as a header)
 +
|  data4 = does not display (same number as a header)
 +
|header5 =
 +
| label5 = Label and data defined (label)
 +
|  data5 = Label and data defined (data)
  
{{Docparam|name=title|req=no|default={{tl|Pagename nd}}|desc=
+
|belowstyle = background:#ddf;
Main title/"headline" of the infobox. By default, the name of the current page without any disambiguation suffixes (i.e. terms in brackets at the end) is used.
+
|below      = Below text
 
}}
 
}}
 +
<source lang="Sass" style="overflow:auto" highlight="15">
 +
{{Infobox
 +
|name        = {{subst:PAGENAME}}
 +
|bodystyle    =
  
{{Docparam|name=width|req=no|default=250px|desc=
+
|titlestyle  =  
Width of the infobox in [[wikipedia:Pixel|pixels]]. In order to achieve a standardized look across all infoboxes, infoboxes should only be resized if absolutely necessary .
+
|abovestyle  = background:#cfc;
}}
+
|subheaderstyle =
 +
|title        = Test Infobox
 +
|above        = Above text
 +
|subheader    = Subheader above image
 +
|subheader2  = Second subheader
  
===Style parameters===
+
|imagestyle  =  
All <code>style</code> options should be used sparingly as they can lead to visual inconsistencies. Some examples of useful styles:
+
|captionstyle =  
* Changing background color: <code>background-color: #123456;</code> (accepts [[wikipedia:HTML color names|HTML color names]] or [[wikipedia:Web colors#Hex triplet|RGB hex triplets]])
+
|  image      = [[File:Example-serious.jpg|200px|alt=Example alt text]]
* Changing (horizontal) text-alignment: <code>text-align: center;</code> (accepts "center", "justify", "left", "right")
+
|caption      = Caption displayed below Example-serious.jpg
* Changing vertical text-alignment: <code>vertical-align: middle;</code> (accepts "bottom", "middle", "top")
 
  
 +
|headerstyle  = background:#ccf;
 +
|labelstyle  = background:#ddf;
 +
|datastyle    =
  
{{Docparam|name=content1-1 style >> content40-4 style|req=no|default=|desc=
+
|header1 = Header defined alone
Specifies [[wikipedia:Cascading Style Sheets|CSS]] styles to apply to the corresponding <code>content</code> cell. For example, <code>content10-3 style</code> applies to the cell of <code>content10-3</code> etc.
+
| label1 =
}}
+
|  data1 =
 +
|header2 =
 +
| label2 = Label defined alone does not display (needs data, or is suppressed)
 +
|  data2 =
 +
|header3 =
 +
| label3 =  
 +
| data3 = Data defined alone
 +
|header4 = All three defined (header, label, data, all with same number)
 +
| label4 = does not display (same number as a header)
 +
|  data4 = does not display (same number as a header)
 +
|header5 =
 +
| label5 = Label and data defined (label)
 +
|  data5 = Label and data defined (data)
  
{{Docparam|name=footer style|req=no|default=|desc=
+
|belowstyle = background:#ddf;
Specifies [[wikipedia:Cascading Style Sheets|CSS]] styles to apply to the <code>footer</code> cell.
+
|below      = Below text
 
}}
 
}}
 +
</source>{{clear}}
  
{{Docparam|name=group1 style >> group40 style|req=no|default=|desc=
+
For this example, the {{para|bodystyle}} and {{para|labelstyle}} parameters are used to adjust the infobox width and define a default width for the column of labels:
Specifies [[wikipedia:Cascading Style Sheets|CSS]] styles to apply to the corresponding <code>group</code> cell. For example, <code>group6 style</code> applies to the cell of <code>group6</code> etc.
 
}}
 
  
{{Docparam|name=icon style|req=no|default=|desc=
+
{{Infobox
Specifies [[wikipedia:Cascading Style Sheets|CSS]] styles to apply to the <code>icon</code>.
+
|name       = Infobox/doc
}}
+
|bodystyle  = width:20em
  
{{Docparam|name=image1 style >> image40 style|req=no|default=|desc=
+
|titlestyle  =  
Specifies [[wikipedia:Cascading Style Sheets|CSS]] styles to apply to the cell with the corresponding <code>image</code>. For example, <code>image9 style</code> applies to the cell of <code>image9</code> etc.
+
|title      = Test Infobox
}}
 
  
{{Docparam|name=label1-1 style >> label40-4 style|req=no|default=|desc=
+
|headerstyle =  
Specifies [[wikipedia:Cascading Style Sheets|CSS]] styles to apply to the corresponding <code>label</code> cell. For example, <code>label20-4 style</code> applies to the cell of <code>label20-4</code> etc.
+
|labelstyle  = width:33%
}}
+
|datastyle  =  
  
{{Docparam|name=main image1 style >> main image5 style|req=no|default=|desc=
+
|header1 =  
Specifies [[wikipedia:Cascading Style Sheets|CSS]] styles to apply to the corresponding <code>main image</code>. For example, <code>main image3 style</code> applies to <code>main image3</code> etc.
+
| label1 = Label 1
}}
+
|  data1 = Data 1
 +
|header2 =
 +
| label2 = Label 2
 +
|  data2 = Data 2
 +
|header3 =  
 +
| label3 = Label 3
 +
| data3 = Data 3
 +
|header4 = Header 4
 +
| label4 =
 +
|  data4 =
 +
|header5 =
 +
| label5 = Label 5
 +
|  data5 = Data 5: Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
  
{{Docparam|name=style|req=no|default=|desc=
+
|belowstyle =  
Specifies [[wikipedia:Cascading Style Sheets|CSS]] styles to apply to every cell in the whole infobox except for the <code>title</code> cell.
+
|below = Below text
 
}}
 
}}
 +
<source lang="sass" highlight="3,9" style="overflow: auto">
 +
{{Infobox
 +
|name        = {{subst:PAGENAME}}
 +
|bodystyle  = width:20em
  
{{Docparam|name=style0 >> style40|req=no|default=|desc=
+
|titlestyle  =  
Specifies [[wikipedia:Cascading Style Sheets|CSS]] styles to apply to all cells within the corresponding group of cells. For example, <code>style3</code> applies to all cells which belong to <code>group3</code> etc.
+
|title      = Test Infobox
}}
 
  
{{Docparam|name=style contents ++ style groups ++ style images ++ style labels ++ style main images|req=no|default=|desc=
+
|headerstyle =  
Specifies [[wikipedia:Cascading Style Sheets|CSS]] styles to apply to all cells of a certain type. For example, <code>style contents</code> applies to all <code>content</code> cells and so forth.
+
|labelstyle  = width:33%
}}
+
|datastyle  =  
  
{{Docparam|name=style contents0 >> style contents40 ++ style images0 >> style images40 ++ style labels0 >> style labels40|req=no|default=|desc=
+
|header1 =  
Specifies [[wikipedia:Cascading Style Sheets|CSS]] styles to apply to a certain type of cells within the corresponding group of cells. For example, <code>style contents5</code> applies to all <code>content</code> cells which belong to <code>group5</code> etc.
+
| label1 = Label 1
}}
+
|  data1 = Data 1
 +
|header2 =
 +
| label2 = Label 2
 +
|  data2 = Data 2
 +
|header3 =  
 +
| label3 = Label 3
 +
| data3 = Data 3
 +
|header4 = Header 4
 +
| label4 =
 +
|  data4 =
 +
|header5 =
 +
| label5 = Label 5
 +
|  data5 = Data 5: Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
  
{{Docparam|name=title style|req=no|default=|desc=
+
|belowstyle =  
Specifies [[wikipedia:Cascading Style Sheets|CSS]] styles to apply to the <code>title</code> cell.
+
|below = Below text
 
}}
 
}}
 +
</source>{{clear}}
  
==Examples==
+
== Embedding ==
===Simple===
+
<!--Linked from [[Template:Subinfobox bodystyle/doc]]-->
{{Infobox
+
One infobox template can be embedded into another using the {{para|child}} parameter or the {{para|embed}} parameter. This feature can be used to create a modular infobox, or to create better-defined logical sections. Long ago, it was necessary to use embedding in order to create infoboxes with more than 99 rows; but nowadays there's no limit to the number of rows that can be defined in a single instance of <code><nowiki>{{infobox}}</nowiki></code>.
|main image1        =Wiki.png
 
|main image1 size  =100x100px
 
|label1-1          =Label 1-1
 
|content1-2        =Content 1-2
 
|image2            =Wiki-wordmark.png
 
|label3-1          =Label 3-1
 
|content3-2        =Content 3-2
 
}}
 
  
<pre>
 
 
{{Infobox
 
{{Infobox
|main image1        =Wiki.png
+
| title = Top level title
|main image1 size  =100x100px
+
| data1 = {{Infobox | decat = yes | child = yes
|label1-1          =Label 1-1
+
    | title = First subsection
|content1-2        =Content 1-2
+
    | label1= Label 1.1
|image2            =Wiki-wordmark.png
+
    | data1 = Data 1.1
|label3-1          =Label 3-1
+
  }}
|content3-2         =Content 3-2
+
| data2 = {{Infobox | decat = yes | child = yes
 +
  |title = Second subsection
 +
  | label1= Label 2.1
 +
  | data1 = Data 2.1
 +
  }}
 +
| belowstyle =  
 +
| below = Below text
 
}}
 
}}
</pre>
+
<pre style="overflow:auto">
{{clear}}
 
===Infobox with groups===
 
 
{{Infobox
 
{{Infobox
|main image1        =Wiki.png
+
| title = Top level title
|main image1 size  =100x100px
+
| data1 = {{Infobox | decat = yes | child = yes
|group1            =Group 1
+
    | title = First subsection
|label2-1           =Label 2-1
+
    | label1= Label 1.1
|content2-2        =Content 2-2
+
    | data1 = Data 1.1
|group3            =Group 3
+
  }}
|label4-1          =Label 4-1
+
| data2 = {{Infobox | decat = yes | child = yes
|content4-2         =Content 4-2
+
  |title = Second subsection
 +
  | label1= Label 2.1
 +
  | data1 = Data 2.1
 +
  }}
 +
| belowstyle =  
 +
| below = Below text
 
}}
 
}}
 +
</pre>{{clear}}
 +
 +
Note, in the examples above, the child infobox is placed in a <code>data</code> field, not a <code>header</code> field.  Notice that the section subheadings are not in bold font if bolding is not explicitly specified. To obtain bold section headings, place the child infobox in a '''header''' field (but not in a '''label''' field because it would not be displayed!), either using
  
<pre>
 
 
{{Infobox
 
{{Infobox
|main image1        =Wiki.png
+
| title = Top level title
|main image1 size  =100x100px
+
| header1 = {{Infobox | decat = yes | child = yes
|group1            =Group 1
+
    | title = First subsection
|label2-1           =Label 2-1
+
    | label1= Label 1.1
|content2-2        =Content 2-2
+
    | data1 = Data 1.1
|group3            =Group 3
+
  }}
|label4-1          =Label 4-1
+
| header2 = {{Infobox | decat = yes | child = yes
|content4-2         =Content 4-2
+
    | title = Second subsection
 +
    | label1= Label 2.1
 +
    | data1 = Data 2.1
 +
  }}
 +
| belowstyle =  
 +
| below = Below text
 
}}
 
}}
</pre>
+
<pre style="overflow:auto">
{{clear}}
 
===Infobox with multiple columns===
 
 
{{Infobox
 
{{Infobox
|main image1        =Wiki.png
+
| title = Top level title
|main image1 size  =100x100px
+
| header1 = {{Infobox | decat = yes | child = yes
|label1-1          =Label 1-1
+
    | title = First subsection
|content1-2        =Content 1-2
+
    | label1= Label 1.1
|content1-3        =Content 1-3
+
    | data1 = Data 1.1
|content1-4        =Content 1-4
+
  }}
|content2-1        =Content 2-1
+
| header2 = {{Infobox | decat = yes | child = yes
|content2-3        =Content 2-3
+
    | title = Second subsection
 +
    | label1= Label 2.1
 +
    | data1 = Data 2.1
 +
  }}
 +
| belowstyle =
 +
| below = Below text
 
}}
 
}}
 +
</pre>{{clear}}
 +
 +
or,
  
<pre>
 
 
{{Infobox
 
{{Infobox
|main image1        =Wiki.png
+
| title = Top level title
|main image1 size  =100x100px
+
| header1 = First subsection
|label1-1          =Label 1-1
+
  {{Infobox | decat = yes | child = yes
|content1-2        =Content 1-2
+
    | label1 = Label 1.1
|content1-3        =Content 1-3
+
    |   data1 = Data 1.1
|content1-4        =Content 1-4
+
  }}
|content2-1        =Content 2-1
+
| header2 = Second subsection
|content2-3        =Content 2-3
+
  {{Infobox | decat = yes | child = yes
 +
    | label1 = Label 2.1
 +
    | data1 = Data 2.1
 +
  }}
 +
| belowstyle =
 +
| below = Below text
 
}}
 
}}
</pre>
+
<pre style="overflow:auto">
{{clear}}
 
===Infobox with collapsible groups===
 
 
{{Infobox
 
{{Infobox
|options            =collapsiblegroups
+
| title = Top level title
|main image1        =Wiki.png
+
| header1 = First subsection
|main image1 size  =100x100px
+
  {{Infobox | decat = yes | child = yes
|group1            =Group 1
+
    | label1 = Label 1.1
|label2-1           =Label 2-1
+
    |   data1 = Data 1.1
|content2-2        =Content 2-2
+
  }}
|group3            =Group 3
+
| header2 = Second subsection
|label4-1          =Label 4-1
+
  {{Infobox | decat = yes | child = yes
|content4-2         =Content 4-2
+
    | label1 = Label 2.1
 +
    | data1 = Data 2.1
 +
  }}
 +
| belowstyle =
 +
| below = Below text
 
}}
 
}}
 +
</pre>{{clear}}
 +
 +
Note that omitting the {{para|title}} parameter, and not including any text preceding the embedded infobox, may result in spurious blank table rows, creating gaps in the visual presentation.
 +
 +
[[Wikipedia:WikiProject Infoboxes/embed]] includes some links to Wikipedia articles which include infoboxes embedded within other infoboxes.
 +
 +
== Subboxes ==
 +
An alternative method for embedding is to use {{para|subbox|yes}}, which removes the outer border from the infobox, but preserves the interior structure.  One feature of this approach is that the parent and child boxes need not have the same structure, and the label and data fields are not aligned between the parent and child boxes because they are not in the same parent table.
  
<pre>
 
 
{{Infobox
 
{{Infobox
|options            =collapsiblegroups
+
| headerstyle = background-color:#eee;
|main image1        =Wiki.png
+
| labelstyle  = background-color:#eee;
|main image1 size   =100x100px
+
| header1 = Main 1
|group1            =Group 1
+
| header2 = Main 2
|label2-1          =Label 2-1
+
data3 = {{Infobox | subbox = yes
|content2-2         =Content 2-2
+
    | headerstyle = background-color:#ccc;
|group3            =Group 3
+
    | labelstyle  = background-color:#ddd;
|label4-1          =Label 4-1
+
    | header1 = Sub 3-1
|content4-2        =Content 4-2
+
    | header2 = Sub 3-2
 +
    |  label3 = Label 3-3    |  data3 = Data 3-3
 +
  }}
 +
|  data4 = {{Infobox | subbox = yes
 +
    | labelstyle  = background-color:#ccc;
 +
    |  label1 = Label 4-1   |   data1 = Data 4-1
 +
  }}
 +
|  label5 = Label 5 |  data5 = Data 5
 +
| header6 = Main 6
 
}}
 
}}
</pre>
+
<source lang="sass" style="overflow:auto">
{{clear}}
 
===Infobox with collapsible and non-collapsible groups===
 
 
{{Infobox
 
{{Infobox
|options            =collapsiblegroups
+
| headerstyle = background-color:#eee;
|main image1        =Wiki.png
+
| labelstyle  = background-color:#eee;
|main image1 size   =100x100px
+
| header1 = Main 1
|group1            =Group 1
+
| header2 = Main 2
|label2-1          =Label 2-1
+
data3 = {{Infobox | subbox = yes
|content2-2         =Content 2-2
+
    | headerstyle = background-color:#ccc;
|group3            =Group 3
+
    | labelstyle  = background-color:#ddd;
|options3          =nocollapse
+
    | header1 = Sub 3-1
|label4-1          =Label 4-1
+
    | header2 = Sub 3-2
|content4-2        =Content 4-2
+
    |  label3 = Label 3-3    |   data3 = Data 3-3
 +
  }}
 +
|  data4 = {{Infobox | subbox = yes
 +
    | labelstyle  = background-color:#ccc;
 +
    |  label1 = Label 4-1   |   data1 = Data 4-1
 +
  }}
 +
|  label5 = Label 5 |  data5 = Data 5
 +
| header6 = Main 6
 
}}
 
}}
 +
</source>{{clear}}
 +
 +
Similar embedding techniques may be used within content parameters of some other templates generating tables (such as [[:Template:Sidebar|Sidebar]]) :
  
<pre>
+
{{Sidebar
{{Infobox
+
| navbar = off
|options            =collapsiblegroups
+
| headingstyle = background-color:#eee;
|main image1        =Wiki.png
+
| heading1 = Heading 1
|main image1 size  =100x100px
+
| heading2 = Heading 2
|group1            =Group 1
+
| content3 = {{Infobox | subbox = yes
|label2-1          =Label 2-1
+
    | headerstyle = background-color:#ccc;
|content2-2         =Content 2-2
+
    | labelstyle = background-color:#ddd;
|group3            =Group 3
+
    | header1 = Sub 3-1
|options3          =nocollapse
+
    | header2 = Sub 3-2
|label4-1          =Label 4-1
+
    |  label3 = Label 3-3 |   data3 = Data 3-3
|content4-2        =Content 4-2
+
  }}
 +
| content4 = {{Infobox | subbox = yes
 +
    | labelstyle = background-color:#ccc;
 +
    |  label1 = Label 4-1 |   data1 = Data 4-1
 +
  }}
 +
| heading5 = Heading 5
 
}}
 
}}
</pre>
+
<source lang="sass" style="overflow:auto">
{{clear}}
+
{{Sidebar
===Infobox with multiple main images===
+
| navbar = off
{{Infobox
+
| headingstyle = background-color:#eee;
|options            =collapsiblegroups
+
| heading1 = Heading 1
|main image1        =Wiki.png
+
| heading2 = Heading 2
|main image2        =Wiki-wordmark.png
+
| content3 = {{Infobox | subbox = yes
|main image3        =Wiki.png
+
    | headerstyle = background-color:#ccc;
|main image4        =Wiki-wordmark.png
+
    | labelstyle = background-color:#ddd;
|main image5        =Wiki.png
+
    | header1 = Sub 3-1
|label1-1          =Label 1-1
+
    | header2 = Sub 3-2
|content1-2        =Content 1-2
+
    | label3 = Label 3-3 |  data3 = Data 3-3
|label2-1           =Label 2-1
+
  }}
|content2-2        =Content 2-2
+
| content4 = {{Infobox | subbox = yes
 +
    | labelstyle = background-color:#ccc;
 +
    | label1 = Label 4-1 |  data1 = Data 4-1
 +
  }}
 +
| heading5 = Heading 5
 
}}
 
}}
 +
</source>{{clear}}
 +
 +
Note that the default padding of the parent data cell containing each subbox is still visible, so the subboxes are slightly narrower than the parent box and there's a higher vertical spacing between standard cells of the parent box than between cells of distinct subboxes.
 +
 +
== Controlling line-breaking in embedded bulletless lists ==
 +
Template {{tlx|nbsp}} may be used with {{tlx|wbr}} and {{tlx|nowrap}} to control line-breaking in bulletless lists embedded in infoboxes (e.g. cast list in {{tlx|Infobox film}}), to prevent wrapped long entries from being confused with multiple entries. See [[Template:Wbr/doc#Controlling line-breaking in infoboxes]] for details.
 +
 +
== Full blank syntax ==
 +
(Note: there is no limit to the number of possible rows; only 20 are given below since infoboxes larger than that will be relatively rare. Just extend the numbering as needed. The microformat "class" parameters are also omitted as they are not commonly used.)
  
<pre>
+
<pre style="overflow:auto">
 
{{Infobox
 
{{Infobox
|options            =collapsiblegroups
+
| name          = {{subst:PAGENAME}}
|main image1       =Wiki.png
+
| child          = {{{child|}}}
|main image2       =Wiki-wordmark.png
+
| subbox        = {{{subbox|}}}
|main image3        =Wiki.png
+
| italic title  = {{{italic title|no}}}
|main image4        =Wiki-wordmark.png
+
| bodystyle      =
|main image5        =Wiki.png
+
 
|label1-1          =Label 1-1
+
| titlestyle    =
|content1-2        =Content 1-2
+
| abovestyle    =
|label2-1          =Label 2-1
+
| subheaderstyle =
|content2-2        =Content 2-2
+
| title          =
}}
+
| above          =
</pre>
+
| subheader      =
{{clear}}
+
 
===Infobox with all main images in one row===
+
|  imagestyle  =
{{Infobox
+
| captionstyle  =
|options            =collapsiblegroups
+
|  image       =  
|main image1        =Wiki.png
+
| caption        =
|main image2        =Wiki-wordmark.png
+
image2       =
|main image3        =Wiki.png
+
| caption2      =
|main image4        =Wiki-wordmark.png
+
 
|main image5        =Wiki.png
+
| headerstyle    =  
|main image columns =5
+
| labelstyle    =  
|label1-1          =Label 1-1
+
|   datastyle    =  
|content1-2        =Content 1-2
+
| header1  =  
|label2-1          =Label 2-1
+
| label1 =
|content2-2        =Content 2-2
+
|  data1  =  
 +
| header2  =  
 +
| label2 =
 +
|  data2  =
 +
| header3  =
 +
|  label3  =
 +
|  data3  =
 +
| header4  =
 +
|  label4  =
 +
|  data4  =
 +
| header5  =
 +
|  label5  =
 +
|  data5  =
 +
| header6  =
 +
|  label6  =
 +
|  data6  =
 +
| header7  =
 +
|  label7  =
 +
|  data7  =
 +
| header8  =
 +
|  label8  =
 +
|  data8  =
 +
| header9  =
 +
|  label9  =
 +
|  data9  =
 +
| header10 =
 +
|  label10 =
 +
|  data10 =
 +
| header11 =
 +
|  label11 =
 +
|  data11 =
 +
| header12 =
 +
|  label12 =
 +
|  data12 =
 +
| header13 =
 +
|  label13 =
 +
|  data13 =
 +
| header14 =  
 +
| label14 =  
 +
|  data14 =
 +
| header15 =
 +
|  label15 =
 +
|  data15 =  
 +
| header16 =  
 +
|  label16 =  
 +
|  data16 =  
 +
| header17 =  
 +
|  label17 =  
 +
|  data17 =
 +
| header18 =  
 +
| label18 =  
 +
|   data18 =  
 +
| header19 =  
 +
| label19 =  
 +
|   data19 =  
 +
| header20 =  
 +
| label20 =  
 +
|   data20 =  
 +
 
 +
| belowstyle    =  
 +
| below          =  
 
}}
 
}}
 +
</pre>{{clear}}
 +
{{Help:Infobox/user style}}
 +
 +
== Porting to other MediaWikis ==
 +
The infobox template requires the [[:mw:Extension:Scribunto|Scribunto]] extension and [[mw:Manual:Using content from Wikipedia#HTMLTidy|HTMLTidy]] to be installed. It may not work with other MediaWikis. [[Wikipedia:WikiProject Transwiki|WikiProject Transwiki]] has a version of this template that has been modified to work on other MediaWikis.
  
<pre>
+
==See also==
{{Infobox
+
* [[Module:Infobox]], the [[WP:LUA|Lua]] module on which this template is based
|options            =collapsiblegroups
+
* [[Special:Permalink/558855956|Template:Infobox/old]], the previous ParserFunctions implementation
|main image1        =Wiki.png
+
* [[Module:Check for unknown parameters]]
|main image2        =Wiki-wordmark.png
+
* {{tl|Infobox3cols}}
|main image3        =Wiki.png
+
* {{tl|Navbox}} and {{tl|Sidebar}}
|main image4        =Wiki-wordmark.png
+
* [[Wikipedia:List of infoboxes|List of infoboxes]]
|main image5        =Wiki.png
+
* [[:Module:InfoboxImage]]
|main image columns =5
+
* Maintenance categories:
|label1-1          =Label 1-1
+
** [[:Category:Articles which use infobox templates with no data rows]] ({{PAGESINCATEGORY:Articles which use infobox templates with no data rows|pages}})
|content1-2        =Content 1-2
+
** [[:Category:Pages which use embedded infobox templates with the title parameter]] ({{PAGESINCATEGORY:Pages which use embedded infobox templates with the title parameter|pages}})
|label2-1          =Label 2-1
+
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox | |
|content2-2        =Content 2-2
+
[[Category:Infobox templates| ]]
}}
+
[[Category:Wikipedia metatemplates|Infobox]]
</pre>
+
[[Category:Templates generating microformats]]
{{clear}}
+
[[Category:Lua-based infobox templates]]
==Copy/paste==
+
}}</includeonly>
<pre>
 
{{Infobox
 
|games              ={{{games|}}}
 
|title              ={{{name|}}}
 
|subtitle          ={{{subtitle|}}}
 
|supertitle        =
 
|supertitle link    =
 
|icon              ={{{icon|}}}
 
|icon offset        ={{{icon offset|}}}
 
|main image1        ={{{image|}}}
 
|main image1 size  ={{{image size|}}}
 
|main image2        ={{{image2|}}}
 
|main image2 size  ={{{image2 size|}}}
 
|main image3        ={{{image3|}}}
 
|main image3 size  ={{{image3 size|}}}
 
|main image4        ={{{image4|}}}
 
|main image4 size  ={{{image4 size|}}}
 
|main image5        ={{{image5|}}}
 
|main image5 size  ={{{image5 size|}}}
 
|main image desc    ={{{image desc|}}}
 
|footer            ={{{footer|}}}
 
|group1            =
 
|label1-1          =
 
|content1-2        ={{{|}}}
 
|group2            =
 
|label2-1          =
 
|content2-2        ={{{|}}}
 
|group3            =
 
|label3-1          =
 
|content3-2        ={{{|}}}
 
|group4            =
 
|label4-1          =
 
|content4-2        ={{{|}}}
 
|group5            =
 
|label5-1          =
 
|content5-2        ={{{|}}}
 
|group6            =
 
|label6-1          =
 
|content6-2        ={{{|}}}
 
|group7            =
 
|label7-1          =
 
|content7-2        ={{{|}}}
 
|group8            =
 
|label8-1          =
 
|content8-2        ={{{|}}}
 
|group9            =
 
|label9-1          =
 
|content9-2        ={{{|}}}
 
|group10            =
 
|label10-1          =
 
|content10-2        ={{{|}}}
 
|group11            =
 
|label11-1          =
 
|content11-2        ={{{|}}}
 
|group12            =
 
|label12-1          =
 
|content12-2        ={{{|}}}
 
|group13            =
 
|label13-1          =
 
|content13-2        ={{{|}}}
 
|group14            =
 
|label14-1          =
 
|content14-2        ={{{|}}}
 
|group15            =
 
|label15-1          =
 
|content15-2        ={{{|}}}
 
|group16            =
 
|label16-1          =
 
|content16-2        ={{{|}}}
 
|group17            =
 
|label17-1          =
 
|content17-2        ={{{|}}}
 
|group18            =
 
|label18-1          =
 
|content18-2        ={{{|}}}
 
|group19            =
 
|label19-1          =
 
|content19-2        ={{{|}}}
 
|group20            =
 
|label20-1          =
 
|content20-2        ={{{|}}}
 
|group21            =
 
|label21-1          =
 
|content21-2        ={{{|}}}
 
|group22            =
 
|label22-1          =
 
|content22-2        ={{{|}}}
 
|group23            =
 
|label23-1          =
 
|content23-2        ={{{|}}}
 
|group24            =
 
|label24-1          =
 
|content24-2        ={{{|}}}
 
|group25            =
 
|label25-1          =
 
|content25-2        ={{{|}}}
 
|group26            =
 
|label26-1          =
 
|content26-2        ={{{|}}}
 
|group27            =
 
|label27-1          =
 
|content27-2        ={{{|}}}
 
|group28            =
 
|label28-1          =
 
|content28-2        ={{{|}}}
 
|group29            =
 
|label29-1          =
 
|content29-2        ={{{|}}}
 
|group30            =
 
|label30-1          =
 
|content30-2        ={{{|}}}
 
|group31            =
 
|label31-1          =
 
|content31-2        ={{{|}}}
 
|group32            =
 
|label32-1          =
 
|content32-2        ={{{|}}}
 
|group33            =
 
|label33-1          =
 
|content33-2        ={{{|}}}
 
|group34            =
 
|label34-1          =
 
|content34-2        ={{{|}}}
 
|group35            =
 
|label35-1          =
 
|content35-2        ={{{|}}}
 
|group36            =
 
|label36-1          =
 
|content36-2        ={{{|}}}
 
|group37            =
 
|label37-1          =
 
|content37-2        ={{{|}}}
 
|group38            =
 
|label38-1          =
 
|content38-2        ={{{|}}}
 
|group39            =
 
|label39-1          =
 
|content39-2        ={{{|}}}
 
|group40            =
 
|label40-1          =
 
|content40-2        ={{{|}}}
 
|group41            =
 
|label41-1          =
 
|content41-2        ={{{|}}}
 
|group42            =
 
|label42-1          =
 
|content42-2        ={{{|}}}
 
|group43            =
 
|label43-1          =
 
|content43-2        ={{{|}}}
 
|label44-1          =
 
|content44-2        ={{{|}}}
 
}}
 
</pre>
 
  
==Technical==
+
==Tracking categories==
* This template is fairly complicated. Editing it requires a good understanding of parser functions and wiki syntax.
+
* {{clc|Articles with missing Wikidata information}}
* Standardized documentation for templates based on this one:
 
** {{tl|Infobox/doc/standard}}
 
<includeonly>[[ja:Template:Infobox]]</includeonly>
 

Version vom 14. August 2019, 09:43 Uhr

Skriptfehler: Ein solches Modul „Distinguish“ ist nicht vorhanden. Vorlage:Mbox

Vorlage:Parameter names example

This template is intended as a meta template: a template used for constructing other templates. Note: In general, it is not meant for use directly in an article, but can be used on a one-off basis if required. Help:Infobox contains an introduction about the recommended content and design of infoboxes; Wikipedia:Manual of Style/Infoboxes contains additional style guidelines. See WP:List of infoboxes and Category:Infobox templates for lists of prepared topic-specific infoboxes.

Usage

Vorlage:Tlf is a meta-template: used to organise an actual {{Infobox sometopic}} template (like {{Infobox building}}).

For [[Template:Infobox sometopic]], template code then looks like this, simplified:

{{Infobox
| name     = {{{name|{{PAGENAME}}}}}
| image    = {{{image|}}}
| caption1 = {{{caption|}}}}}}

| label1   = Former names
|  data1   = {{{former_names|}}}

| header2  = General information

| label3   = Status
|  data3   = {{{status|}}}
... <!-- etc. -->
}}

Optional control parameters

name 
If this parameter is present, "view/discuss/edit" links will be added to the bottom of the infobox, pointing to the named page. You may use the value {{subst:PAGENAME}}; however this is rarely what you want, because it will send users clicking these links in an infobox in an article to the template code rather than the data in the infobox that they probably want to change.
child 
See the Embedding section for details. If this is set to "yes", this child infobox should be titled but have no name parameter. This parameter is empty by default, set it to "yes" to activate it.
subbox 
See the Subboxes section for details. If this is set to "yes", this subbox should be titled but have no name parameter. This parameter is empty by default, set to "yes" to activate it. It has no effect if the child parameter is also set to "yes".
decat 
If this is set to "yes", the current page will not be autocategorized in a maintenance category when the generated infobox has some problems or no visible data section. Leave empty by default or set to "yes" to activate it.

Content parameters

Title

There are two different ways to put a title on an infobox. One contains the title inside the infobox's border in the uppermost cell of the table, the other puts as a caption it on top of the table. You can use both of them together if you like, or just one or the other, or even neither (though this is not recommended):

title 
Text to put in the caption over the top of the table (or as section header before the whole content of this table, if this is a child infobox). For accessibility reasons, this is the most recommended alternative.
above 
Text to put within the uppermost cell of the table.
subheader(n) 
additional title fields which fit below {{{title}}} and {{{above}}}, but before images.

Examples:

Text in caption over infobox
Subheader of the infobox
{{Infobox
 | name = {{subst:PAGENAME}}
 | title      = Text in caption over infobox
 | subheader  = Subheader of the infobox
 | header = (the rest of the infobox goes here)
}}
Text in uppermost cell of infobox
Subheader of the infobox
Second subheader of the infobox
{{Infobox
 | name = {{subst:PAGENAME}}
 | above      = Text in uppermost cell of infobox
 | subheader  = Subheader of the infobox
 | subheader2 = Second subheader of the infobox
 | header = (the rest of the infobox goes here)
}}

Illustration images

image(n) 
images to display at the top of the template. Use full image syntax, for example [[File:example.png|200px|alt=Example alt text]]. Image is centered by default. See WP:ALT for more on alt text.
caption(n) 
Text to put underneath the images.

Main data

header(n) 
Text to use as a header in row n.
label(n) 
Text to use as a label in row n.
data(n) 
Text to display as data in row n.

Note: for any given value for (n), not all combinations of parameters are permitted. The presence of a Vorlage:Para will cause the corresponding Vorlage:Para (and Vorlage:Para Vorlage:Para, see below) to be ignored; the absence of a Vorlage:Para will cause the corresponding Vorlage:Para to be ignored. Valid combinations for any single row are:

See the rendering of header4, label4, and data4 in the Examples section below.

Number ranges

To allow flexibility when the layout of an infobox is changed, it may be helpful when developing an infobox to use non-contiguous numbers for header and label/data rows. Parameters for new rows can then be inserted in future without having to renumber existing parameters. For example:

 | header3  = Section 1
 |  label5  = Label A
 |   data5  = Data A
 |  label7  = Label C
 |   data7  = Data C
 | header10 = Section 2
 |  label12 = Label D
 |   data12 = Data D

It is also possible to automatically renumber parameter names by using User:Frietjes/infoboxgap.js or Module:IncrementParams.

Making data fields optional

A row with a label but no data is not displayed. This allows for the easy creation of optional infobox content rows. To make a row optional use a parameter that defaults to an empty string, like so:

 |  label5 = Population
 |   data5 = {{{population|}}}

This way if an article doesn't define the population parameter in its infobox the row won't be displayed.

For more complex fields with pre-formatted contents that would still be present even if the parameter wasn't set, you can wrap it all in an "#if" statement to make the whole thing vanish when the parameter is not used. For instance, the "#if" statement in the following example reads "#if:the parameter mass has been supplied |then display it, followed by 'kg'":

 |  label6 = Mass
 |   data6 = {{ #if: {{{mass|}}} | {{{mass}}} kg }}

For more on #if, see here.

Hiding headers when all data fields are hidden

You can also make headers optional in a similar way. Consider this example:

Example of an undesirable header
Undesirable header
Static header
Static itemStatic value
{{Infobox
 | title   = Example of an undesirable header
 | header1 = Undesirable header
 |  label2 = Item 1      |   data2 =
 |  label3 = Item 2      |   data3 =
 |  label4 = Item 3      |   data4 =
 | header5 = Static header
 |  label6 = Static item |   data6 = Static value
}}

If you want the first header to appear only if one or more of the data fields that fall under it are filled, one could use the following pattern as an example of how to do it:

Example of an optional header
Static header
Static itemStatic value
{{Infobox
 | title   = Example of an optional header
 | header1 = {{ #if: {{{item1|}}}{{{item2|}}}{{{item3|}}} | Optional header }}
 |  label2 = Item 1      |   data2 = {{{item1|}}}
 |  label3 = Item 2      |   data3 = {{{item2|}}}
 |  label4 = Item 3      |   data4 = {{{item3|}}}
 | header5 = Static header
 |  label6 = Static item |   data6 = Static value
}}

header1 will be shown if any of item1, item2, or item3 is defined. If none of the three parameters are defined the header won't be shown and no empty row appears before the next static content. The trick to this is that the #if returns false only if there is nothing whatsoever in the conditional section, so only if all three of item1, item2 and item3 are undefined will the if statement fail.

Note that such trick may be sometimes very complex to test if there are many data items whose value depends on complex tests (or when a data row is generated by a recursive invokation of this template as a subbox). Ideally, the Lua module supporting this template should now support a new way to make each header row autohideable by detecting if there is at least one non-empty data row after that header row (a parameter like Vorlage:Para, for example, would remove the need to perform the #if test so that we can just to define Vorlage:Para),

Footer

below 
Text to put in the bottom cell. The bottom cell is intended for footnotes, see-also, and other such information.

Presentation parameters

Italic titles

Titles of articles with infoboxes may be made italic, in line with WP:ITALICTITLE, by passing the italic title parameter.

  • Turn on italic titles by passing Vorlage:Para from the infobox.
  • Turn off by default (notably because only Latin script may be safely rendered in this style and italic may be needed to distinguish foreign language from local English language only in that script, but would be difficult to read for other scripts) but allow some instances to be made italic by passing Vorlage:Para
  • Do not make any titles italic by not passing the parameter at all.

CSS styling

bodystyle 
Applies to the infobox table as a whole
titlestyle 
Applies only to the title caption. Adding a background color is usually inadvisable since the text is rendered "outside" the infobox.
abovestyle 
Applies only to the "above" cell at the top. The default style has font-size:125%; since this cell is usually used for a title, if you want to use the above cell for regular-sized text include "font-size:100%;" in the abovestyle.
imagestyle 
Applies to the cell the image is in. This includes the text of the image caption, but you should set text properties with captionstyle instead of imagestyle in case the caption is moved out of this cell in the future.
captionstyle 
Applies to the text of the image caption.
rowstyle(n) 
This parameter is inserted into the style attribute for the specified row.
headerstyle 
Applies to all header cells
labelstyle 
Applies to all label cells
datastyle 
Applies to all data cells
belowstyle 
Applies only to the below cell

HTML classes and microformats

bodyclass 
This parameter is inserted into the class attribute for the infobox as a whole.
titleclass 
This parameter is inserted into the class attribute for the infobox's title caption.
aboveclass 
This parameter is inserted into the class attribute for the infobox's above cell.
subheaderrowclass(n) 
This parameter is inserted into the class attribute for the complete table row the subheader is on.
subheaderclass(n) 
This parameter is inserted into the class attribute for the infobox's subheader.
imagerowclass(n) 
These parameters are inserted into the class attribute for the complete table row their respective image is on.
imageclass 
This parameter is inserted into the class attribute for the image.
rowclass(n) 
This parameter is inserted into the class attribute for the specified row including the label and data cells.
class(n) 
This parameter is inserted into the class attribute for the data cell of the specified row. If there's no data cell it has no effect.
belowclass 
This parameter is inserted into the class attribute for the infobox's below cell.

This template supports the addition of microformat information. This is done by adding "class" attributes to various data cells, indicating what kind of information is contained within. Multiple class names may be specified, separated by spaces, some of them being used as selectors for custom styling according to a project policy or to the skin selected in user preferences, others beig used for microformats.

To flag an infobox as containing hCard information, for example, add the following parameter:

 | bodyclass = vcard

And for each row containing a data cell that's part of the vcard, add a corresponding class parameter:

 | class1 = fn
 | class2 = org
 | class3 = tel

...and so forth. "above" and "title" can also be given classes, since these are usually used to display the name of the subject of the infobox.

See Wikipedia:WikiProject Microformats for more information on adding microformat information to Wikipedia, and microformat for more information on microformats in general.

Examples

Notice how the row doesn't appear in the displayed infobox when a label is defined without an accompanying data cell, and how all of them are displayed when a header is defined on the same row as a data cell. Also notice that subheaders are not bold by default like the headers used to split the main data section, because this role is meant to be for the above cell :

Test Infobox
Above text
Subheader above image
Second subheader
200px
Caption displayed below File:Example-serious.jpg
Header defined alone
Data defined alone
All three defined (header, label, data, all with same number)
Label and data defined (label)Label and data defined (data)
Below text
{{Infobox
 |name         = {{subst:PAGENAME}}
 |bodystyle    = 

 |titlestyle   = 
 |abovestyle   = background:#cfc;
 |subheaderstyle =
 |title        = Test Infobox
 |above        = Above text
 |subheader    = Subheader above image
 |subheader2   = Second subheader

 |imagestyle   = 
 |captionstyle = 
 |  image      = [[File:Example-serious.jpg|200px|alt=Example alt text]]
 |caption      = Caption displayed below Example-serious.jpg

 |headerstyle  = background:#ccf;
 |labelstyle   = background:#ddf;
 |datastyle    = 

 |header1 = Header defined alone
 | label1 = 
 |  data1 = 
 |header2 = 
 | label2 = Label defined alone does not display (needs data, or is suppressed)
 |  data2 = 
 |header3 =
 | label3 = 
 |  data3 = Data defined alone
 |header4 = All three defined (header, label, data, all with same number)
 | label4 = does not display (same number as a header)
 |  data4 = does not display (same number as a header)
 |header5 =
 | label5 = Label and data defined (label)
 |  data5 = Label and data defined (data)

 |belowstyle = background:#ddf;
 |below      = Below text
}}

For this example, the Vorlage:Para and Vorlage:Para parameters are used to adjust the infobox width and define a default width for the column of labels:

Test Infobox
Label 1Data 1
Label 2Data 2
Label 3Data 3
Header 4
Label 5Data 5: Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Below text
{{Infobox
 |name        = {{subst:PAGENAME}}
 |bodystyle   = width:20em

 |titlestyle  = 
 |title       = Test Infobox

 |headerstyle = 
 |labelstyle  = width:33%
 |datastyle   = 

 |header1 = 
 | label1 = Label 1
 |  data1 = Data 1
 |header2 = 
 | label2 = Label 2
 |  data2 = Data 2
 |header3 = 
 | label3 = Label 3
 |  data3 = Data 3
 |header4 = Header 4
 | label4 = 
 |  data4 = 
 |header5 = 
 | label5 = Label 5
 |  data5 = Data 5: Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

 |belowstyle = 
 |below = Below text
}}

Embedding

One infobox template can be embedded into another using the Vorlage:Para parameter or the Vorlage:Para parameter. This feature can be used to create a modular infobox, or to create better-defined logical sections. Long ago, it was necessary to use embedding in order to create infoboxes with more than 99 rows; but nowadays there's no limit to the number of rows that can be defined in a single instance of {{infobox}}.

Top level title
First subsection
Label 1.1Data 1.1
Second subsection
Label 2.1Data 2.1
Below text
{{Infobox
 | title = Top level title
 | data1 = {{Infobox | decat = yes | child = yes
    | title = First subsection
    | label1= Label 1.1
    | data1 = Data 1.1
   }}
 | data2 = {{Infobox | decat = yes | child = yes
  |title = Second subsection
  | label1= Label 2.1
  | data1 = Data 2.1
  }}
 | belowstyle = 
 | below = Below text
}}

Note, in the examples above, the child infobox is placed in a data field, not a header field. Notice that the section subheadings are not in bold font if bolding is not explicitly specified. To obtain bold section headings, place the child infobox in a header field (but not in a label field because it would not be displayed!), either using

Top level title
First subsection
Label 1.1Data 1.1
Second subsection
Label 2.1Data 2.1
Below text
{{Infobox
 | title = Top level title
 | header1 = {{Infobox | decat = yes | child = yes
    | title = First subsection
    | label1= Label 1.1
    | data1 = Data 1.1
   }}
 | header2 = {{Infobox | decat = yes | child = yes
    | title = Second subsection
    | label1= Label 2.1
    | data1 = Data 2.1
   }}
 | belowstyle = 
 | below = Below text
}}

or,

Top level title
First subsection
Label 1.1Data 1.1
Second subsection
Label 2.1Data 2.1
Below text
{{Infobox
 | title = Top level title
 | header1 = First subsection
   {{Infobox | decat = yes | child = yes
    | label1 = Label 1.1
    |   data1 = Data 1.1
   }}
 | header2 = Second subsection
   {{Infobox | decat = yes | child = yes
    | label1 = Label 2.1
    |  data1 = Data 2.1
   }}
 | belowstyle = 
 | below = Below text
}}

Note that omitting the Vorlage:Para parameter, and not including any text preceding the embedded infobox, may result in spurious blank table rows, creating gaps in the visual presentation.

Wikipedia:WikiProject Infoboxes/embed includes some links to Wikipedia articles which include infoboxes embedded within other infoboxes.

Subboxes

An alternative method for embedding is to use Vorlage:Para, which removes the outer border from the infobox, but preserves the interior structure. One feature of this approach is that the parent and child boxes need not have the same structure, and the label and data fields are not aligned between the parent and child boxes because they are not in the same parent table.

Main 1
Main 2
Sub 3-1
Sub 3-2
Label 3-3Data 3-3
Label 4-1Data 4-1
Label 5Data 5
Main 6
{{Infobox
 | headerstyle = background-color:#eee;
 | labelstyle  = background-color:#eee;
 | header1 = Main 1
 | header2 = Main 2
 |   data3 = {{Infobox | subbox = yes
    | headerstyle = background-color:#ccc;
    | labelstyle  = background-color:#ddd;
    | header1 = Sub 3-1
    | header2 = Sub 3-2
    |  label3 = Label 3-3    |   data3 = Data 3-3
   }}
 |   data4 = {{Infobox | subbox = yes
    | labelstyle  = background-color:#ccc;
    |  label1 = Label 4-1    |   data1 = Data 4-1
   }}
 |  label5 = Label 5 |   data5 = Data 5
 | header6 = Main 6
}}

Similar embedding techniques may be used within content parameters of some other templates generating tables (such as Sidebar) :

Vorlage:Sidebar

{{Sidebar
 | navbar = off
 | headingstyle = background-color:#eee;
 | heading1 = Heading 1
 | heading2 = Heading 2
 | content3 = {{Infobox | subbox = yes
    | headerstyle = background-color:#ccc;
    | labelstyle = background-color:#ddd;
    | header1 = Sub 3-1
    | header2 = Sub 3-2
    |  label3 = Label 3-3 |   data3 = Data 3-3
   }}
 | content4 = {{Infobox | subbox = yes
    | labelstyle = background-color:#ccc;
    |  label1 = Label 4-1 |   data1 = Data 4-1
   }}
 | heading5 = Heading 5
}}

Note that the default padding of the parent data cell containing each subbox is still visible, so the subboxes are slightly narrower than the parent box and there's a higher vertical spacing between standard cells of the parent box than between cells of distinct subboxes.

Controlling line-breaking in embedded bulletless lists

Template Vorlage:Tlx may be used with Vorlage:Tlx and Vorlage:Tlx to control line-breaking in bulletless lists embedded in infoboxes (e.g. cast list in Vorlage:Tlx), to prevent wrapped long entries from being confused with multiple entries. See Template:Wbr/doc#Controlling line-breaking in infoboxes for details.

Full blank syntax

(Note: there is no limit to the number of possible rows; only 20 are given below since infoboxes larger than that will be relatively rare. Just extend the numbering as needed. The microformat "class" parameters are also omitted as they are not commonly used.)

{{Infobox
| name           = {{subst:PAGENAME}}
| child          = {{{child|}}}
| subbox         = {{{subbox|}}}
| italic title   = {{{italic title|no}}}
| bodystyle      = 

| titlestyle     = 
| abovestyle     = 
| subheaderstyle = 
| title          = 
| above          = 
| subheader      = 

|   imagestyle   = 
| captionstyle   = 
|   image        = 
| caption        = 
|   image2       = 
| caption2       = 

| headerstyle    = 
|  labelstyle    = 
|   datastyle    = 
| header1  = 
|  label1  = 
|   data1  = 
| header2  = 
|  label2  = 
|   data2  = 
| header3  = 
|  label3  = 
|   data3  = 
| header4  = 
|  label4  = 
|   data4  = 
| header5  = 
|  label5  = 
|   data5  = 
| header6  = 
|  label6  = 
|   data6  = 
| header7  = 
|  label7  = 
|   data7  = 
| header8  = 
|  label8  = 
|   data8  = 
| header9  = 
|  label9  = 
|   data9  = 
| header10 = 
|  label10 = 
|   data10 = 
| header11 = 
|  label11 = 
|   data11 = 
| header12 = 
|  label12 = 
|   data12 = 
| header13 = 
|  label13 = 
|   data13 = 
| header14 = 
|  label14 = 
|   data14 = 
| header15 = 
|  label15 = 
|   data15 = 
| header16 = 
|  label16 = 
|   data16 = 
| header17 = 
|  label17 = 
|   data17 = 
| header18 = 
|  label18 = 
|   data18 = 
| header19 = 
|  label19 = 
|   data19 = 
| header20 = 
|  label20 = 
|   data20 = 

| belowstyle     = 
| below          = 
}}

Hilfe:Infobox/user style

Porting to other MediaWikis

The infobox template requires the Scribunto extension and HTMLTidy to be installed. It may not work with other MediaWikis. WikiProject Transwiki has a version of this template that has been modified to work on other MediaWikis.

See also


Tracking categories