Open main menu

Changes

Template:Infobox/doc

715 bytes removed, 03:14, 21 March 2008
formatting, +link to #if info, +See also link
{{Documentation documentation subpage}}
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE. -->
<includeonly>{{Intricate intricate template}}</includeonly>
==Usage==
====Title====
{{infobox|Infobox|title=Text in caption over infobox|data1= (the rest of the infobox goes here)
}}
{{infobox|Infobox|above=Text in uppermost cell of infobox|data1= (the rest of the infobox goes here)
}}
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>|bodyclass= vcard</pre>
And for each row containing a data cell that's part of the vcard, add a corresponding class parameter:
<pre>|class1= fn|class2= org|class3= tel
</pre>
And ...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 [http://microformats.org/wiki/Main_Page microformats.org] for more information on microformats in general.
<pre>
| label5 = Population| data5 = {{{population|}}}
</pre>
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-formated 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. ExampleFor instance, the "#if" statement in the following example reads "#if:the parameter ''mass'' has been supplied |then display it, followed by 'kg'":
<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:
<prestyle="overflow:auto;">
{{Infobox
| name = {{subst:PAGENAME}}| title = Example of an optional header| header1 = {{#if: {{{item_one|}}}{{{item_two|}}}{{{item_three|}}} | Optional header }}| label2 = Item Oneone| data2 = {{{item_one|}}}| label3 = Item Twotwo| data3 = {{{item_two|}}}| label4 = Item Threethree| data4 = {{{item_three|}}}
}}
</pre>
{{Infobox
| name = Infobox/doc| bodystyle = |title = Test Infobox| titlestyle = |image = [[Image:example.png|200px]]| imagestyle = |caption = Caption for example.png| captionstyle = | headerstyle = | labelstyle = | datastyle = | belowstyle =  | title = Test Infobox
| image header1 = [[Image:example.pngHeader defined alone|label1 = |data1 = |header2 = |label2 = Label defined alone|data2 = |header3 =|label3 = |data3 = Data defined alone|200px]]header4 = All three defined (header)|label4 = All three defined (label)|data4 = All three defined (data)|header5 =|label5 = Label and data defined (label)| caption data5 = Caption for example.pngLabel and data defined (data)
| header1 belowstyle = Header defined alone| label1 = | data1 =  | header2 = | label2 = Label defined alone| data2 =  | header3 =| label3 = | data3 = Data defined alone | header4 = All three defined (header)| label4 = All three defined (label)| data4 = All three defined (data) | header5 =| label5 = Label and data defined (label)| data5 = Label and data defined (data) | below = Below text
}}
<prestyle="overflow:auto;">
{{Infobox
| name = Infobox/doc|title = Test Infobox|image = [[Image:example.png|200px]]|caption = Caption for example.png
| title header1 = Test InfoboxHeader defined alone|label1 = |data1 = |header2 = |label2 = Label defined alone|data2 = |header3 = |label3 = |data3 = Data defined alone|header4 = All three defined (header)|label4 = All three defined (label)|data4 = All three defined (data)|header5 = |label5 = Label and data defined (label)|data5 = Label and data defined (data)
| image = [[Image:example.png|200px]]| caption = Caption for example.png | header1 = Header defined alone| label1 = | data1 =  | header2 = | label2 = Label defined alone| data2 =  | header3 = | label3 = | data3 = Data defined alone | header4 = All three defined (header)| label4 = All three defined (label)| data4 = All three defined (data) | header5 = | label5 = Label and data defined (label)| data5 = Label and data defined (data) | 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.
<br {{clear="all"/>}}For this example , {{nowrap|bodystyle = &#0061; width:20em; }} and {{nowrap|labelstyle = &#0061; width:33%;}}
{{Infobox
| name = Infobox/doc| bodystyle = width:20em;| titlestyle name = Infobox/doc| imagestyle title = Test Infobox| captionstyle titlestyle = | headerstyle = | labelstyle = width:33%;| datastyle = | belowstyle =  | title = Test Infobox | header1 = | label1 = Label 1| data1 = Data 1 | header2 = | label2 = Label 2| data2 = Data 2
|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.
| header4 belowstyle = 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. | below = Below text
}}
<br {{clear="all"/>}}
This example is the same as the above but shows the use of the "above" parameter for an alternate title style:
{{Infobox
| name = Infobox/doc| bodystyle = width:20em;| titlestyle name = Infobox/doc| imagestyle above = Test Infobox| captionstyle abovestyle = | headerstyle = | labelstyle = width:33%;| datastyle = | belowstyle =
| above header1 = Test Infobox|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.
| header1 belowstyle = | 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. | below = Below text
}}
<br {{clear}}==Full blank syntax=="all"/>
==Full blank declaration==(Note: the template currently handles up to 40 rows; only 20 are included here 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.)
(Note<pre style="overflow: the template currently handles up to 40 rows, only 20 are included here since infoboxes larger than that will be relatively rare. Just extend the numbering as needed. The microformat "classauto;" parameters are also omitted as they are not commonly used.) <pre>
{{Infobox
| name = {{subst:PAGENAME}}| bodystyle = | titlestyle title = | abovestyle titlestyle = | imagestyle above = | captionstyle = | headerstyle = | labelstyle abovestyle = | datastyle image = | belowstyle imagestyle =  | title = | above =  | image = | caption =  | header1 captionstyle = | label1 headerstyle = | data1 labelstyle =  | header2 datastyle = | 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 belowstyle =
|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 =
| header18 belowstyle = | label18 = | data18 =  | header19 = | label19 = | data19 =  | header20 = | label20 = | data20 =  | below =
}}
</pre>
==See also==
* {{tl|start infobox page}}
 
<includeonly><!--++++ PLEASE ADD CATEGORIES AND INTERWIKIS BELOW THIS LINE, THANK YOU. -->[[Category:infobox Infobox templates| ]]
[[Category:Wikipedia metatemplates|{{PAGENAME}}]]
[[Category:Templates using ParserFunctions|{{PAGENAME}}]]
Anonymous user