Changes

Jump to navigation Jump to search

Template:Infobox/doc

498 bytes added, 00:38, 10 September 2019
m
427 revisions imported
{{distinguish|Template:Userbox}}
{{Documentation subpage}}
<includeonly>{{#ifeq:{{#titleparts:{{PAGENAME}}|1|2}}|old | |{{High-riskuse|29620003,000,000+ pages, which is ≈&thinsp;{{#expr:(296224200/{{NUMBEROFPAGES:R}}) round 0}}% of all}}{{Lua|Module:Infobox}}}}</includeonly>
{{Parameter names example
|name={{PAGENAME}} <!--|child |subbox |decat--> |title |above |subheader |subheader1 |subheader2={{{subheader2}}}<br/>......
== Usage ==
Usage {{tlf|Infobox}} is similar a meta-template: used to organise an actual <nowiki>{{Infobox sometopic}}</nowiki> template (like {{tl|navboxInfobox building}}, but with an additional distinction. 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).
To insert an image somewhere other than at the top of the infoboxFor <code><nowiki>[[Template:Infobox sometopic]]</nowiki></code>, or to insert freeform datatemplate code then looks like this, use a row with only a data fieldsimplified:<pre>{{Infobox| name = {{{name|{{PAGENAME}}}}}| image = {{{image|}}}| caption1 = {{{caption|}}}}}} | label1 = Former names| data1 = {{{former_names|}}} | header2 = General information | label3 = Status| data3 = {{{status|}}}... <!-- etc.-->}}</pre>
== Optional control parameters ==
| label6 = Static item | data6 = Static value
}}
<pre source lang="moin" style="overflow:auto">
{{Infobox
| title = Example of an optional header
| label6 = Static item | data6 = Static value
}}
</presource>{{clear}}
header1 will be shown if any of item1, item2, or item3 is defined. If none of the three parameters are defined the header won't be shown and no emty empty row appears before the next static content. The trick to this is that the "<code>#if" </code> returns false only if there is nothing whatsoever in the conditional section, so only if all three of item1, item2 and item3 are undefined will the if statement fail.
Note that such trick may be sometimes very complex to test if there are many data items whose value depends on complex tests (or when a data row is generated by a recursive invokation of this template as a [[#Subboxes|subbox]]). Ideally, the Lua module supporting this template should now support a new way to make each header row autohideable by detecting if there is at least one non-empty data row after that header row (a parameter like "{{para|autohide header1 = | yes"}}, for example, would remove the need to perform the "<code>#if" </code> test so that we can just to define "{{para|header1 = | Optional header"}}),
=== Footer ===
|titlestyle =
|abovestyle = background:#cfc;
|subheaderstyle =
|title = Test Infobox
|below = Below text
}}
<pre source lang="Sass" style="overflow:auto" highlight="15">
{{Infobox
|name = {{subst:PAGENAME}}
|titlestyle =
|abovestyle = background:#cfc;
|subheaderstyle =
|title = Test Infobox
|below = Below text
}}
</presource>{{clear}}
For this example, the '''{{para|bodystyle''' }} and '''{{para|labelstyle''' }} parameters are used to adjust the infobox width and define a default width for the column of labels:
{{Infobox
|below = Below text
}}
<pre source lang="sass" highlight="3,9" style="overflow: auto">
{{Infobox
|name = {{subst:PAGENAME}}
|below = Below text
}}
</presource>{{clear}}
== Embedding ==
* [[Module:Infobox]], the [[WP:LUA|Lua]] module on which this template is based
* [[Special:Permalink/558855956|Template:Infobox/old]], the previous ParserFunctions implementation
* [[Module:Check for unknown parameters]]
* {{tl|Infobox3cols}}
* {{tl|Navbox}} and {{tl|Sidebar}}
* [[:Module:InfoboxImage]]
* Maintenance categories:
** [[:Category:Articles which use infobox templates with no data rows]]({{PAGESINCATEGORY:Articles which use infobox templates with no data rows|pages}})** [[:Category:Pages which use embedded infobox templates with the title parameter]]({{PAGESINCATEGORY:Pages which use embedded infobox templates with the title parameter|pages}})
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox | |
[[Category:Infobox templates| ]]
[[Category:Wikipedia metatemplates|Infobox]]
[[Category:Templates generating microformats]]
[[Category:Lua-based infobox templates]]
}}</includeonly>
 
==Tracking categories==
* {{clc|Articles with missing Wikidata information}}

Navigation menu