Template:Infobox/doc: Difference between revisions
imported>Caesar Schinas m (note) |
imported>Robert A. Estremo (→Usage: expand to 50 rows) |
||
(6 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
This template is mainly intended to be used for the creation of other infoboxes | This template is mainly intended to be used for the creation of other infoboxes, and all infoboxes should use it. See {{tl|Infobox Software}} for an example. | ||
It can, however, equally well be used to create one-off infoboxes on individual articles. | |||
See {{tl|Infobox Software}} for an example. | |||
To create a new infobox template, enter its name in the box below, after '''Template:Infobox_''', and then click the Create Infobox Template button.<br /> | |||
Infobox names should be in Title Case, where each word starts with a capital letter. | |||
<div style="width:50%"> | |||
<inputbox> | |||
type=create | |||
default=Template:Infobox_ | |||
preload=Template:Infobox/preload | |||
editintro=Template:Infobox/editintro | |||
break=no | |||
buttonlabel=Create Infobox | |||
</inputbox> | |||
</div> | |||
Then follow the instructions on the edit page.<br /> | |||
After you have created your template, click the '''Create Documentation''' link on the new template page, and follow the instructions to document your new template.<br /> | |||
Then, '''please add your template to [[CZ:Templates]]''', in the relevant section. | |||
Infoboxes based on this template will be automatically added to [[:Category:Templates/Infoboxes]]. | |||
=== Usage === | |||
An infobox consists of a title, an optional subtitle, and several rows of data, each consisting of a label and a data cell. Examples can be seen [[#Example|below]]. | |||
The following parameters can be used in the creation of infoboxes. Both are ''optional'', but the '''title''' should normally be specified. | |||
;title | |||
:Defines the title for the infobox. | |||
;subtitle | |||
:Defines the subtitle for the infobox. | |||
==== | Each row in the infobox can be defined using a combination of the following parameters, replacing the # by the number of the row (the row number is necessary for technical reasons; it will not be shown in the infobox). These parameters are all ''optional'', though it is clearly pointless to create an infobox with no data whatsoever.<br /> | ||
It is possible to create infoboxes with up to 50 rows, though this parameter can easily be changed if need be. | |||
;<nowiki>#</nowiki>_label | |||
:The label for the row. | |||
:If this parameter is blank or not defined, the label will be hidden and the data cell will occupy the full width of the row. | |||
:A full-width label, or header, can be made by setting the '''data''' parameter for the same row to three hyphens ( '''<nowiki>---</nowiki>''' ). | |||
;<nowiki>#</nowiki>_data | |||
:The data for the row. | |||
:If this parameter is blank or not defined, the entire row will be hidden, including the label. | |||
:This feature can be taken advantage of in infoboxes based on this template to make their own parameters optional, by defining them as follows : <code> 1_data = <nowiki>{{{param|}}}</nowiki> </code>. | |||
:A full-width data row, with no label, can be shown simply by leaving the '''label''' parameter for the same row blank or not defining it. | |||
The following ''optional'' parameters allow [[CSS]] styles to be applied to the infobox. Each style parameter should end with a semicolon ( ''';''' ). | |||
;style | |||
:CSS which applies to the entire infobox. | |||
;titlestyle | |||
:CSS which applies to the title. | |||
;subtitlestyle | |||
:CSS which applies to the subtitle. | |||
;labelstyle | |||
:CSS which applies to every label or header in the infobox. | |||
;datastyle | |||
:CSS which applies to every data cell in the infobox. | |||
;<nowiki>#</nowiki>_labelstyle | |||
:CSS which only applies to the label with the same number. This overrides the general '''labeltitle''' parameter. | |||
;<nowiki>#</nowiki>_datastyle | |||
:CSS which only applies to the data cell with the same number. This overrides the general '''datatitle''' parameter. | |||
=== Examples === | |||
The following example illustrates the basic syntax for the creation of a simple, standard, infobox. | |||
{{Infobox | {{Infobox | ||
| style = background:#ccf; | | title = This is the title | ||
| 1_label = Row 1 Label | |||
| 1_data = Row 1 Data | |||
| 2_label = Row 2 Label | |||
| 2_data = Row 2 Data | |||
}} | |||
<pre> | |||
{{Infobox | |||
| title = This is the title | |||
| 1_label = Row 1 Label | |||
| 1_data = Row 1 Data | |||
| 2_label = Row 2 Label | |||
| 2_data = Row 2 Data | |||
}} | |||
</pre> | |||
The following more complex example illustrates the usage of styles, headers, and full-width data rows. | |||
{{Infobox | |||
| style = background:#ccf; border:1px dashed #00f; | |||
| labelstyle = background:#99f; color:#00f; | | labelstyle = background:#99f; color:#00f; | ||
| datastyle = background:#eef; color:#009; | | datastyle = background:#eef; color:#009; | ||
Line 55: | Line 117: | ||
| 4_data = --- | | 4_data = --- | ||
| 5_label = 5 A Label only | | 5_label = 5 A Label only (doesn't work..) | ||
| 6_data = 6 Some data only that expands across both columns | | 6_data = 6 Some data only that expands across both columns | ||
Line 106: | Line 168: | ||
| 4_data = --- | | 4_data = --- | ||
| 5_label = 5 A Label only | | 5_label = 5 A Label only (doesn't work...) | ||
| 6_data = 6 Some data only that expands across both columns | | 6_data = 6 Some data only that expands across both columns |
Latest revision as of 17:42, 21 August 2013
This template is mainly intended to be used for the creation of other infoboxes, and all infoboxes should use it. See {{Infobox Software}} for an example. It can, however, equally well be used to create one-off infoboxes on individual articles.
To create a new infobox template, enter its name in the box below, after Template:Infobox_, and then click the Create Infobox Template button.
Infobox names should be in Title Case, where each word starts with a capital letter.
Then follow the instructions on the edit page.
After you have created your template, click the Create Documentation link on the new template page, and follow the instructions to document your new template.
Then, please add your template to CZ:Templates, in the relevant section.
Infoboxes based on this template will be automatically added to Category:Templates/Infoboxes.
Usage
An infobox consists of a title, an optional subtitle, and several rows of data, each consisting of a label and a data cell. Examples can be seen below.
The following parameters can be used in the creation of infoboxes. Both are optional, but the title should normally be specified.
- title
- Defines the title for the infobox.
- subtitle
- Defines the subtitle for the infobox.
Each row in the infobox can be defined using a combination of the following parameters, replacing the # by the number of the row (the row number is necessary for technical reasons; it will not be shown in the infobox). These parameters are all optional, though it is clearly pointless to create an infobox with no data whatsoever.
It is possible to create infoboxes with up to 50 rows, though this parameter can easily be changed if need be.
- #_label
- The label for the row.
- If this parameter is blank or not defined, the label will be hidden and the data cell will occupy the full width of the row.
- A full-width label, or header, can be made by setting the data parameter for the same row to three hyphens ( --- ).
- #_data
- The data for the row.
- If this parameter is blank or not defined, the entire row will be hidden, including the label.
- This feature can be taken advantage of in infoboxes based on this template to make their own parameters optional, by defining them as follows :
1_data = {{{param|}}}
. - A full-width data row, with no label, can be shown simply by leaving the label parameter for the same row blank or not defining it.
The following optional parameters allow CSS styles to be applied to the infobox. Each style parameter should end with a semicolon ( ; ).
- style
- CSS which applies to the entire infobox.
- titlestyle
- CSS which applies to the title.
- subtitlestyle
- CSS which applies to the subtitle.
- labelstyle
- CSS which applies to every label or header in the infobox.
- datastyle
- CSS which applies to every data cell in the infobox.
- #_labelstyle
- CSS which only applies to the label with the same number. This overrides the general labeltitle parameter.
- #_datastyle
- CSS which only applies to the data cell with the same number. This overrides the general datatitle parameter.
Examples
The following example illustrates the basic syntax for the creation of a simple, standard, infobox.
This is the title | |
---|---|
Row 1 Label | Row 1 Data |
Row 2 Label | Row 2 Data |
{{Infobox | title = This is the title | 1_label = Row 1 Label | 1_data = Row 1 Data | 2_label = Row 2 Label | 2_data = Row 2 Data }}
The following more complex example illustrates the usage of styles, headers, and full-width data rows.
This is the title | |
---|---|
This is the subtitle | |
1 A Header | |
2 A Label | 2 Some Data |
3 Another Label | 3 Some more Data |
4 A Header | |
6 Some data only that expands across both columns | |
7 A Header | |
8 A Label | 8 Some Data |
9 Another Label | 9 Some more Data |
10 Another Label | 10 Some more Data |
11 A Header | |
12 Some data only that expands across both columns |
{{Infobox | style = background:#ccf; | labelstyle = background:#99f; color:#00f; | datastyle = background:#eef; color:#009; | title = This is the title | titlestyle = color:#f00; | subtitle = This is the subtitle | subtitlestyle = color:#00f; | 1_label = 1 A Header | 1_data = --- | 2_label = 2 A Label | 2_data = 2 Some Data | 3_label = 3 Another Label | 3_data = 3 Some more Data | 4_label = 4 A Header | 4_data = --- | 5_label = 5 A Label only (doesn't work...) | 6_data = 6 Some data only that expands across both columns | 7_label = 7 A Header | 7_labelstyle = background:lightgrey; | 7_data = --- | 8_label = 8 A Label | 8_labelstyle = background:lightblue; font-style:italic; | 8_data = 8 Some Data | 9_label = 9 Another Label | 9_data = 9 Some more Data | 9_datastyle = background:lightgreen; font-style:italic; | 10_label = 10 Another Label | 10_labelstyle = background:lightblue; | 10_data = 10 Some more Data | 10_datastyle = background:lightgreen; | 11_label = 11 A Header | 11_data = --- | 12_data = 12 Some data only that expands across both columns | 12_datastyle = background:lightgreen; font-style:italic; border:1px solid red; }}