Template:Infobox/doc: Difference between revisions
Content deleted Content added
m 1 revision imported |
greatly simplified |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1:
{{Documentation subpage}}
{{Lua|Module:Infobox}}
{{tlf|Infobox}} is a meta-template: used to organise an actual <nowiki>{{Infobox sometopic}}</nowiki> template (like {{tl|Infobox Version}}).
For <code><nowiki>[[Template:Infobox sometopic]]</nowiki></code>, template code then looks like this, simplified:
<syntaxhighlight lang="wikitext">
{{Infobox
|
| image = {{{image|}}}
| caption1 = {{{caption|}}}
Line 41 ⟶ 24:
== Optional control parameters ==
; nocat : If this is set to "yes", the current page will not be autocategorized in a maintenance category when the generated infobox has some problems or no visible data section. Leave empty by default or set to "yes" to activate it.
== Content parameters ==
=== Title ===
; title : Text to put within the uppermost cell of the table.
=== Illustration images ===
; image(n) : 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>
; caption(n) : Text to put underneath the images.
Line 104 ⟶ 46:
* {{para|rowclass''(n)''}} {{para|class''(n)''}} {{para|data''(n)''}}
* {{para|rowclass''(n)''}} {{para|label''(n)''}} {{para|class''(n)''}} {{para|data''(n)''}}
==== Number ranges ====
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:
<syntaxhighlight lang="wikitext" style="overflow: auto;">
| header3 = Section 1
| label5 = Label A
Line 119 ⟶ 59:
| label12 = Label D
| data12 = Data D
</syntaxhighlight>
{{clear}}
There is no upper limit on numbers but there must be at most 50 between each used number.
Line 128 ⟶ 67:
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:
<syntaxhighlight lang="wikitext" style="overflow: auto;">
|
|
</syntaxhighlight>
{{clear}}
This way if an article doesn't define the population parameter in its infobox the row won't be displayed.
Line 137 ⟶ 77:
For more complex fields with pre-formatted 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'":
<syntaxhighlight lang="wikitext" style="overflow: auto;">
|
|
</syntaxhighlight>
{{clear}}
For more on #if, see [[
=== Footer ===
;
===
{{div col}}
; bodyclass : This parameter is inserted into the <code>class</code> attribute for the infobox as a whole.
; titleclass : This parameter is inserted into the <code>class</code> attribute for the infobox's '''title'''
; imagerowclass(n) : These parameters are inserted into the <code>class</code> attribute for the complete table row their respective '''image''' is on.
; imageclass : This parameter is inserted into the <code>class</code> attribute for the '''image'''.
; rowclass(n) : This parameter is inserted into the <code>class</code> attribute for the specified row including the '''label''' and '''data''' cells.
; class(n) : This parameter is inserted into the <code>class</code> attribute for the '''data''' cell of the specified row. If there's no '''data''' cell it has no effect.
; footerclass : This parameter is inserted into the <code>class</code> attribute for the infobox's '''footer''' cell.
{{div col end}}
== TemplateData ==
Line 767 ⟶ 103:
<templatedata>
{
}
}
</templatedata>
Line 800 ⟶ 136:
==Tracking categories==
* {{Category link with count|Articles using infobox templates with no data rows}}
==See also==
* [[Progressbar95 Wiki:List of infoboxes|List of infoboxes]]
<includeonly>{{Sandbox other||
<!-- Categories below this line, please
[[Category:Infobox templates| ]]
}}</includeonly>
|