Open main menu

Changes

Template:Infobox/doc

794 bytes added, 00:20, 22 June 2009
update documentation
{{Infobox
|title = Text in caption over infobox
|subheader = Subheader of the infobox
|data1 = (the rest of the infobox goes here)
}}
{{Infobox
|above = Text in uppermost cell of infobox
|subheader = Subheader of the infobox
|subheader2 = 2<sup>nd</sup> subheader of the infobox
|data1 = (the rest of the infobox goes here)
}}
====Optional content====
;subheader1subheader, subheader2: additional title fields which fit between {{{title}}} and {{{above}}}.;image1image, image2: images to display at the top of the template. Use full image syntax, for example <nowiki>[[Image:example.png|200px]]</nowiki>. Image is centered by default.;imageleft, imageright : a couple of small images shown just above "image".;caption1, caption2 , captionleft, captionright: Text to put underneath the images.
;header(n) : Text to use as a header in row n.
;label(n): Text to use as a label in row n.
====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.;imageclass: This parameter is inserted into the "class" attribute for the image; it is in particular used in conjunction with {{tl|Image class names}}.;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. ;titleclass: This parameter is inserted into the "class" attribute for the infobox's title caption.;aboveclassbelowclass : This parameter is inserted into the "class" attribute for the infobox's above 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. To flag an infobox as containing hCard information, for example, add the following parameter:
<pre>
|label6 = Mass
|data6 = {{#if:{{{mass|}}} |{{{mass}}} kg}}
</pre>
For more on #if, see [[meta:ParserFunctions##if:|here]].<br/> 
You can also make headers optional in a similar way. If you want a 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:
<pre style="overflow:auto;">{{Infobox
|name = {{subst:PAGENAME}}
|title = Example of an optional header
|label4 = Item three
|data4 = {{{item_three|}}}
}}</pre>
header1 will be shown if any of item_one, item_two, or item_three is defined. If none of the three parameters are defined the header won't be shown.
|title = Test Infobox
|titlestyle =
 
|imageleft = example.png
|imageleftsize = 75px
|captionleft = Left caption
|imageright = example.png
|imagerightsize = 75px
|captionright = Right caption
 
|image = [[Image:example.png|200px]]
|imagestyle =
}}
<pre style="overflow:auto;">{{Infobox
|name = Infobox/doc
|bodystyle =
|title = Test Infobox
|titlestyle =
 
|imageleft = example.png
|imageleftsize = 75px
|captionleft = Left caption
|imageright = example.png
|imagerightsize = 75px
|captionright = Right caption
 
|image = [[Image:example.png|200px]]
|imagestyle =
|belowstyle = background:#ddf;
|below = Below text
}}</pre>
Notice how when a label is defined without an accompanying data cell the row doesn't appear in the displayed infobox, and when a header is defined on the same row as a data cell the header takes precedence.
{{Infobox
|bodystyle = width:20em;|name = Infobox/doc|title = Test Infobox|titlestyle = |headerstyle = |labelstyle = width:33%;|datastyle =
|header1 =
|above =
|abovestyle =
 
|imagestyle =
|captionstyle =
 
|image =
|imagestyle =
|caption =
|captionstyle image2 = |caption2 =  |imageleft = |imageleftsize = |captionleft =  |imageright = |imagerightsize = |captionright =  
|headerstyle =
|labelstyle =
|belowstyle =
|below =
}}</pre>
=== Porting to other MediaWikis ===
[[sv:Mall:Infobox]]
[[th:แม่แบบ:กล่องข้อมูล]]
[[tr:Şablon:Infobox]]
[[uk:Шаблон:Картка]]
[[zh:Template:Infobox]]
</includeonly>
Anonymous user