Template:Infobox/doc: Difference between revisions

From Random Island Wiki
Jump to navigation Jump to search
>Keanu217
>Ludwigs2
m (Reverted 3 edits by Keanu217 identified as vandalism to last revision by Ludwigs2. using TW)
Line 1: Line 1:
== Cheap Food for Hard Times ==
{{documentation subpage}}
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE. -->


[[File:cheapfoodforhardtimes.jpg]]
This template is intended as a meta-template: a template used for constructing other templates. it is not meant for use directly in an article, but can be used on a one-off basis if required. See [[Help:Infobox]] for an introduction to infoboxes and information on how to design them. See [[:Category:Infobox templates]] for specific infobox templates.


    In this day with the economy in the state it is , we are all suffering to make ends meet and put food on the table.  Existence
=== Usage ===
seems to be more a battle of basic survival for many families, living paycheck to paycheck. 
Usage is similar to {{tl|navbox}}, but with an additional distinction. Each row on the table can either be a "header", or it can have a label/data pair, or it can just be a data cell. These are mutually exclusive states so if you define a row to be both a header and a label/data pair, the label/data pair is overridden.
    We have become a nation of experts at juggling the bills, you know the story , pay one or two and put the rest on the back burner
till next payday.  The bottom line is that really doesn't leave much money leftover for the food budget.


    I've noticed a really interesting trend amongst your local food vendor for awhile now.  Have you become aware of the fact that  
Note that if you want to insert an image elsewhere other than the top of the infobox, or insert other "freeform" data, using a row with just a "data" field allows for that sort of thing.
when you find some food item that you can buy for cheap and put together a real cheap meal that is healthy and nutritious that somehow
the grocer gets wind of it and the next time you go shopping the price of that item has gone up.  Its makes life a little harder and
challenging to keep ahead of the price increases at the local market.


      In order to survive, I've put together a few recipes that are delicious and nutritious and won't break your food budget, and the kids
When developing an infobox, it is often a good idea to use non-contiguous numbers for the header and labal/data rows.  for example:
enjoy them as well.
<pre>|header3 = Section 1
I figure also that if you might have a favorite recipe that you put together it would be great to have you share it with the rest of the world .
|label5 = XXX
      Many times by combining very simple ingredients you have leftover in the cupboards you can come up with some real winners.
|data5= YYY
   
|label7 = QQQ
    Here is one of my favorite recipes that is both Nutritious and delicious:  '''Delicious Dinner Idea | Brown Rice Roast Beef & Vegetables'''
|data7 = RRR
|header10 = Section2
|label12 = AAA
|data12 = BBB</pre>
Header and labal/data rows are not shown if they have no data, so this construction renders nicely but allows for easy revision  and expansion of the template, since new rows can be added without renumbering all the remaining rows in the template.


This recipe  sticks to the ribs on a cold winters day. This is really tasty addition to anyones weekly menu lineup.
=== Parameters ===
====View/discuss/edit links====
;name : The template page name that the "view/discuss/edit" links should point to. You can use <nowiki>{{subst:PAGENAME}}</nowiki>. If this parameter is omitted the view/discuss/edit links will not be displayed.


  1. Some useful cooking supplies to have on hand , is a rice steamer with multiple steam trays. [[File:cheapfoodforhardtimes_.jpg]]
====Title====
{{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)
}}


  2. A Large boiling pot , such as for boiling noodles.
There are two different ways to put a title on an infobox. One contains the title inside the infobox's border, the other puts it on top as a caption. 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 top of the table.
;above : Text to put within the uppermost cell of the table.


  3. Roast Beef Chuck Roast
====Optional content====
;subheader, subheader2 : additional title fields which fit between {{{title}}} and {{{above}}}.
;image, image2 : 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.
;caption1, caption2 : 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.
;data(n): Text to display as data in row n.
;below: Text to put in the bottom cell. The bottom cell is intended for footnotes, see-also, and other such information.


  4. 2 Stalks of celery
Note: currently, headers, labels and data items with the same n-value are mutually exclusive; only the header will be displayed. See the rendering of header4, label4, and data4 in the examples section below.


  5. half a bag of your 1 lb bag of brown rice
====Optional 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:large; since this cell is usually used for a title, if you want to use the above cell for regular-sized text include "font-size:medium;" 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.
;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


  6. 1 large Chinese bitter Melon
==== HTML classes ====
;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.
; aboverowclass : This parameter is inserted into the "class" attribute for the complete table row the "above" cell is on.
; subheaderclass : This parameter is inserted into the "class" attribute for the infobox's subheader.
; subheaderrowclass : This parameter is inserted into the "class" attribute for the complete table row the subheader is on.
;imageclass : This parameter is inserted into the "class" attribute for the image; it is in particular used in conjunction with {{tl|Image class names}}.
; imagerowclass1, imagerowclass1 : These parameters are inserted into the "class" attribute for the complete table row the respective images are on.
;rowclass(n) : This parameter is inserted into the "class" attribute for the specified row '''including''' the label or other explanatory text.
;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.


  7. garlic powder
==== Microformats ====


  8. salt
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:


  9. pepper
<pre>
|bodyclass = vcard
</pre>


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


  11. curry powder
<pre>
|class1 = fn
|class2 = org
|class3 = tel
</pre>


  12. oregano
...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.


  13. Chinese lite soy sauce
See [[Wikipedia:WikiProject Microformats]] for more information on adding microformat information to Wikipedia, and [[microformat]] for more information on microformats in general.


  14. 1 lb baby carrots
===Making 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:


  15. 1/2 diced onion
<pre>
|label5 = Population
|data5  = {{{population|}}}
</pre>


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


  17. small teaspoon of meat tenderizer
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. For instance, the "#if" statement in the following example reads "#if:the parameter ''mass'' has been supplied |then display it, followed by 'kg'":


You start with a chuck roast, which you boil in the bottom of the rice steam pot and you boil it till done usually about 1.5 hours  on medium heat.
<pre>
Next your going to dice up the celery and put in the bottom pan with the roast. In addition you want to slice the bitter melon in half and than
|label6 = Mass
slice into small pieces  and place these bottom .  Throw in the carrots and seasonings, to suit your palate.
|data6 = {{#if:{{{mass|}}}|{{{mass}}} kg}}
</pre>


Now meanwhile, at the same time  that you put the Roast and vegetables to cook also in the larger  boiling pot you measure out half of the 2 lb bag
For more on #if, see [[meta:ParserFunctions##if:|here]].
into the pot.  Taker  your index finger and measure the depth of  the rice in the pan.  Than by looking at how far your rice depth measures up
finger, you want to put in 1 and a half times as much water in the rice pan.


You start the rice out on high heat and than once its reached the boiling point you turn the heat down to medium low heat.
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:


Than once the rice is done and the Roast and vegetables are cooked , than you combine everything in the large already cooked rice pot with the rice
<pre style="overflow:auto;">{{Infobox
in there as well.
|name    = {{subst:PAGENAME}}
It is at this time that this time that you are going to start to season the soup, I usually season to my taste, and put soy sauce at least a few shakes
|title  = Example of an optional header
  for flavor.  In addition , I add alot of garlic powder, salt , pepper, oregano , a little curry powder , and the celery salt and in this case a little
|header1 = {{#if:{{{item_one|}}}{{{item_two|}}}{{{item_three|}}}|Optional header}}
  meat tenderizer (no msg) for the roast .
|label2 = Item one
Once the meat is done don't forget to cut the meat up into small bite size chunks.
|data2  = {{{item_one|}}}
One thing not to forget is after the roast is done you want to make sure to take the broth that is created with the boiled roast and it is added into the pot.
|label3 = Item two
  This is your soup base.
|data3  = {{{item_two|}}}
|label4 = Item three
|data4  = {{{item_three|}}}
}}</pre>


Now the easy part kick back for about 20 minutes and allow the soup ingredients to blend and cook down , which intensifies the flavor.  This makes enough to
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.
easily feed a family of 4, or if you like it gets better with each day as leftovers. I usually eat mine for about at least about 5 days for lunch and dinner.
Enjoy and please let me know how you like it.


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 item_one, item_two and item_three are undefined will the if statement fail.


This recipe is by far one of my favorites.  It is really gtood for warming you up on a cold winters day.  I also find it gives you alot of strength to get
===Examples===
things done during the week, such as work and enough energy to last.
{{Infobox
|name        = Infobox/doc
|bodystyle    =
|title        = Test Infobox
|titlestyle  =


  1. Some useful cooking supplies to have on hand , is a rice steamer with multiple steam trays.
|image        = [[File:example.png|200px|alt=Example alt text]]
  2. A Large boiling pot , such as for boiling noodles.
|imagestyle  =
  3. Three chicken breasts.
|caption      = Caption for example.png
  4. 2 Stalks of celery
|captionstyle =
  5. half a bag of your 1 lb bag of brown rice
|headerstyle  = background:#ccf;
  6. 1 large Chinese bitter Melon
|labelstyle  = background:#ddf;
  7. garlic powder
|datastyle   =
   8. salt
  9. pepper
  10. celery salt
  11. curry powder
  12. oregano
  13. Chinese lite soy sauce


You start with three chicken breasts, which you put in the bottom of the rice steam pot and you boil them till done usually about 25 minutes at
|header1 = Header defined alone
  the most on high heat.
|label1  =
Next your going to dice up the celery and cut the cauliflower into large chunks. and place these into the steamer trays.  You put  butter on
|data1  =
the cauliflower along with some garlic powder, than cover the steamer lid and let it steam while the chicken is cooking.
|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)


Now meanwhile, at the same time  that you put the chicken and vegetables to cook also in the larger  boiling pot you measure out half of the
|belowstyle = background:#ddf;
2 lb bag into the pot.  Taker  your index finger and measure the depth of  the rice in the pan.  Than by looking at how far your rice
|below = Below text
up on your finger, you want to put in 1 and a half times as much water in the rice pan.
}}
You start the rice out on high heat and than once its reached the boiling point you turn the heat down to medium low heat.


Than once the rice is done and the chicken and vegetables are cooked , than you combine everything in the large already cooked rice pot with
<pre style="overflow:auto">{{Infobox
the rice in there as well.
|name        = Infobox/doc
It is at this time that this time that you are going to start to season the soup, I usually season to my taste, and put soy sauce at least a
|bodystyle    =
few shakes for flavor.  In addition , I add a lot of garlic powder, salt , pepper, oregano , a little curry powder , and the celery salt.
|title        = Test Infobox
|titlestyle  =


For more great money saving and delicious recipes check out [http://www.cheapfoodforhardtimes.com Cheap Food for Hard Times]
|image        = [[File:example.png|200px|alt=Example alt text]]
|imagestyle  =
|caption      = Caption for example.png
|captionstyle =
|headerstyle  = background:#ccf;
|labelstyle  = background:#ddf;
|datastyle    =


[[User:Keanu217|Keanu217]] ([[User talk:Keanu217#top|talk]]) 20:21, 19 January 2010 (UTC)
|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)


|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.


{{refbegin}}http://www.cheapfoodforhardtimes.com{{refend}}
{{clear}}
For this example, {{nowrap|bodystyle &#0061; width:20em;}} and {{nowrap|labelstyle &#0061; width:33%;}}
 
{{Infobox
|bodystyle  = width:20em;
|name        = Infobox/doc
|title      = Test Infobox
|titlestyle  =
|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
}}
 
{{clear}}
 
=== Full blank syntax ===
(Note: the template currently handles up to 80 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.)
 
<pre style="overflow:auto;">
{{Infobox
|name        = {{subst:PAGENAME}}
|bodystyle    =
|title        =
|titlestyle  =
|above        =
|abovestyle  =
 
|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 =
}}</pre>
 
=== Porting to other MediaWikis ===
The infobox template requires the tidy extension to be installed, and may not work with other MediaWikis the [[WP:TRAN]] has a version of Infobox that has been modified to work on other MediaWikis.
 
=== See also ===
* {{tl|start infobox page}}
 
<includeonly>
[[Category:Infobox templates| ]]
[[Category:Templates generating microformats]]
[[Category:Wikipedia metatemplates|Infobox]]
 
[[ar:قالب:قالب معلومات]]
[[be-x-old:Шаблён:Infobox]]
[[bg:Шаблон:Infobox]]
[[bs:Šablon:Infokutija]]
[[cs:Šablona:Infobox]]
[[da:Skabelon:Infoboks-en]]
[[de:Vorlage:Infobox]]
[[et:Mall:Infobox]]
[[eo:Ŝablono:Informkesto]]
[[es:Plantilla:Ficha]]
[[fa:الگو:دادان]]
[[fr:Modèle:Infobox]]
[[hsb:Předłoha:Infokašćik]]
[[ia:Patrono:Infobox]]
[[os:Шаблон:Infobox]]
[[it:Template:Infobox]]
[[is:Snið:Infobox]]
[[mk:Шаблон:Infobox]]
[[no:Mal:Infoboks]]
[[ja:Template:Infobox]]
[[ko:틀:정보상자]]
[[ka:თარგი:ინფოდაფა]]
[[nn:Mal:Infoboks]]
[[pt:Predefinição:Infobox]]
[[ru:Шаблон:Карточка]]
[[sk:Šablóna:Infobox]]
[[sl:Predloga:Infopolje]]
[[sv:Mall:Infobox]]
[[th:แม่แบบ:กล่องข้อมูล]]
[[tr:Şablon:Infobox]]
[[uk:Шаблон:Картка]]
[[zh:Template:Infobox]]
</includeonly>

Revision as of 17:00, 19 January 2010

This template is intended as a meta-template: a template used for constructing other templates. it is not meant for use directly in an article, but can be used on a one-off basis if required. See Help:Infobox for an introduction to infoboxes and information on how to design them. See Category:Infobox templates for specific infobox templates.

Usage

Usage is similar to {{navbox}}, but with an additional distinction. Each row on the table can either be a "header", or it can have a label/data pair, or it can just be a data cell. These are mutually exclusive states so if you define a row to be both a header and a label/data pair, the label/data pair is overridden.

Note that if you want to insert an image elsewhere other than the top of the infobox, or insert other "freeform" data, using a row with just a "data" field allows for that sort of thing.

When developing an infobox, it is often a good idea to use non-contiguous numbers for the header and labal/data rows. for example:

|header3 = Section 1
|label5 = XXX
|data5= YYY
|label7 = QQQ
|data7 = RRR
|header10 = Section2
|label12 = AAA
|data12 = BBB

Header and labal/data rows are not shown if they have no data, so this construction renders nicely but allows for easy revision and expansion of the template, since new rows can be added without renumbering all the remaining rows in the template.

Parameters

View/discuss/edit links

name
The template page name that the "view/discuss/edit" links should point to. You can use {{subst:PAGENAME}}. If this parameter is omitted the view/discuss/edit links will not be displayed.

Title

Text in caption over infobox
Subheader of the infobox
(the rest of the infobox goes here)
Text in uppermost cell of infobox
Subheader of the infobox
2nd subheader of the infobox
(the rest of the infobox goes here)

There are two different ways to put a title on an infobox. One contains the title inside the infobox's border, the other puts it on top as a caption. 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 top of the table.
above
Text to put within the uppermost cell of the table.

Optional content

subheader, subheader2
additional title fields which fit between {{{title}}} and {{{above}}}.
image, image2
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.
caption1, caption2
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.
data(n)
Text to display as data in row n.
below
Text to put in the bottom cell. The bottom cell is intended for footnotes, see-also, and other such information.

Note: currently, headers, labels and data items with the same n-value are mutually exclusive; only the header will be displayed. See the rendering of header4, label4, and data4 in the examples section below.

Optional 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:large; since this cell is usually used for a title, if you want to use the above cell for regular-sized text include "font-size:medium;" 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.
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

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.
aboverowclass
This parameter is inserted into the "class" attribute for the complete table row the "above" cell is on.
subheaderclass
This parameter is inserted into the "class" attribute for the infobox's subheader.
subheaderrowclass
This parameter is inserted into the "class" attribute for the complete table row the subheader is on.
imageclass
This parameter is inserted into the "class" attribute for the image; it is in particular used in conjunction with {{Image class names}}.
imagerowclass1, imagerowclass1
These parameters are inserted into the "class" attribute for the complete table row the respective images are on.
rowclass(n)
This parameter is inserted into the "class" attribute for the specified row including the label or other explanatory text.
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.

Microformats

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:

|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.

Making 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-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. 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.

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:

{{Infobox
|name    = {{subst:PAGENAME}}
|title   = Example of an optional header
|header1 = {{#if:{{{item_one|}}}{{{item_two|}}}{{{item_three|}}}|Optional header}}
|label2  = Item one
|data2   = {{{item_one|}}}
|label3  = Item two
|data3   = {{{item_two|}}}
|label4  = Item three
|data4   = {{{item_three|}}}
}}

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.

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 item_one, item_two and item_three are undefined will the if statement fail.

Examples

Test Infobox
Example alt text
Caption for example.png
Header defined alone
Data defined alone
All three defined (header)
Label and data defined (label)Label and data defined (data)
Below text
{{Infobox
|name         = Infobox/doc
|bodystyle    = 
|title        = Test Infobox
|titlestyle   = 

|image        = [[File:example.png|200px|alt=Example alt text]]
|imagestyle   = 
|caption      = Caption for example.png
|captionstyle = 
|headerstyle  = background:#ccf;
|labelstyle   = background:#ddf;
|datastyle    = 

|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)

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

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.

For this example, bodystyle = width:20em; and labelstyle = width:33%;

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

Full blank syntax

(Note: the template currently handles up to 80 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.)

{{Infobox
|name         = {{subst:PAGENAME}}
|bodystyle    = 
|title        = 
|titlestyle   = 
|above        = 
|abovestyle   = 

|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 = 
}}

Porting to other MediaWikis

The infobox template requires the tidy extension to be installed, and may not work with other MediaWikis the WP:TRAN has a version of Infobox that has been modified to work on other MediaWikis.

See also