From DominionStrategy Wiki
(Difference between revisions)
Jump to: navigation, search
m (Documentation)
m (Reverted edits by (talk) to last revision by TwiNight)
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<!-- Ripped from Wikipedia
<!-- Ripped from Wikipedia
-->{{#ifeq:{{{child|}}}|yes||<table class="infobox {{{bodyclass|}}}" cellspacing="3" style="border-spacing: 3px; width:22em; {{{bodystyle|}}}"><!--
-->{{#ifeq:{{{child|}}}|yes||<table cellspacing="3" style="border-spacing: 3px; width:22em; border: 1px solid #AAA; background-color: #F9F9F9; color: black; margin: 0.5em 0 0.5em 1em; padding: 0.2em; float: right; clear: right; text-align: left; font-size: 88%; line-height: 1.5em; {{{bodystyle|}}}"><!--
-->{{#if:{{{title|}}}|<caption class="{{{titleclass|}}}" style="{{{titlestyle|}}}">{{{title}}}</caption>}}<!--
-->{{#if:{{{title|}}}|<caption class="{{{titleclass|}}}" style="{{{titlestyle|}}}">{{{title}}}</caption>}}<!--
Line 141: Line 141:
  |¬|no      = <!-- no italic title -->
  |¬|no      = <!-- no italic title -->
  ||force|yes = {{italic title|force={{#ifeq:{{lc:{{{italic title|}}}}}|force|true}}}}
  ||force|yes = {{italic title|force={{#ifeq:{{lc:{{{italic title|}}}}}|force|true}}}}
}}<noinclude><br style="clear:both" />

Latest revision as of 23:00, 14 January 2013

This is the Infobox template ripped from Wikipedia, only reduced number of max. groups, removed categorization, and some modification for porting. For more info, go to the Wikipedia page. (All parameter are kept) Part of the documentation there is included here


[edit] Usage

Each row on the table can contain either a header, or a label/data pair, or just a data cell. These are mutually exclusive states so if you define a row with both a header and a label/data pair, the label/data pair is ignored.

[edit] Number ranges

Row numbers may be from 1 to 20. 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 B
|label7   = Label C
|data7    = Data C
|header10 = Section 2
|label12  = Label D
|data12   = Data D

[edit] Parameters

All parameter are optional

[edit] View/discuss/edit links

If this parameter is present, "view/discuss/edit" links will be added to the bottom of the infobox, pointing to the named template. You can use {{subst:FULLPAGENAME}}.
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.

[edit] Title

Text to put within the uppermost cell of the table.

[edit] Optional content

subheader, subheader2 
additional title fields which fit below {{{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.
caption, caption2 
Text to put underneath the images.
Text to use as a header in row n.
Text to use as a label in row 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 header(n) will cause the corresponding data(n) and label(n) to be ignored; the absence of a data(n) will cause the corresponding label(n) to be ignored. Valid combinations for any single row are:

  • header(n)
  • data(n)
  • label(n) + data(n)

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

[edit] Optional CSS styling

Applies to the infobox table as a whole
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.
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.
Applies to the text of the image caption.
Applies to all header cells
Applies to all label cells
Applies to all data cells

[edit] 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.

[edit] Examples

Test Infobox
Example alt text
Caption for example.png
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)
|name         = Template:Infobox/doc
|bodystyle    = 

|above        = Test Infobox
|abovestyle   = 

|image        = [[File:Card back.jpg|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 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)

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

Test Infobox
Label 1 Data 1
Label 2 Data 2
Label 3 Data 3
Header 4
Label 5 Data 5: Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
|bodystyle   = width:20em;
|name        = Template:Infobox/doc

|above       = Test Infobox
|abovestyle  = 

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