Template:Infobox/doc: Difference between revisions

From Chalo Chatu, Zambia online encyclopedia
m
1 revision imported
m (1 revision imported)
 
m (1 revision imported)
 
(3 intermediate revisions by one other user not shown)
Line 1: Line 1:
{{distinguish|Template:Userbox}}
{{distinguish|Template:Userbox}}
{{Documentation subpage}}
{{Documentation subpage}}
<includeonly>{{#ifeq:{{#titleparts:{{PAGENAME}}|1|2}}|old | |{{High-risk|2,520,000+}}{{Lua|Module:Infobox}}}}</includeonly>
<includeonly>{{#ifeq:{{#titleparts:{{PAGENAME}}|1|2}}|old | |{{High-use|3,160,000+|info=[https://en.wikipedia.org/w/index.php?search=hastemplate%3Ainfobox&title=Special:Search&profile=default&fulltext=1&searchToken=69ttd5z1iekjo54r1z2qvq3uo 3,035,000] of the {{NUMBEROFARTICLES}} pages in mainspace that qualify as articles transclude infoboxes ({{#expr:(3035000*100/{{NUMBEROFARTICLES:R}}) round 0}}%).|all-pages = yes}}{{Lua|Module:Infobox}}}}</includeonly>
{{Generic template demo
{{Parameter names example
  |name={{PAGENAME}} <!--|child |subbox |decat--> |title |above |subheader |subheader1 |subheader2={{{subheader2}}}<br/>......
  |name={{PAGENAME}} <!--|child |subbox |decat--> |title |above |subheader |subheader1 |subheader2={{{subheader2}}}<br/>......
  |image|caption |image1|caption1 |image2|caption2={{{caption2}}}<br/>......
  |image|caption |image1|caption1 |image2|caption2={{{caption2}}}<br/>......
Line 15: Line 15:
}}
}}


This template is intended as a meta template: a template used for constructing other templates. '''Note''': In general, it is not meant for use directly in an article, but can be used on a one-off basis if required. [[Help:Infobox]] contains an introduction about the recommended content and design of infoboxes. See [[WP:List of infoboxes]] and [[:Category:Infobox templates]] for lists of prepared topic-specific infoboxes.
This template is intended as a meta template: a template used for constructing other templates. '''Note''': In general, it is not meant for use directly in an article, but can be used on a one-off basis if required. [[Help:Infobox]] contains an introduction about the recommended content and design of infoboxes; [[Wikipedia:Manual of Style/Infoboxes]] contains additional style guidelines. See [[WP:List of infoboxes]] and [[:Category:Infobox templates]] for lists of prepared topic-specific infoboxes.


== Usage ==
== Usage ==
Line 169: Line 169:
</pre>{{clear}}
</pre>{{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 row appears before the next static content. 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 item1, item2 and item3 are undefined will the if statement fail.
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 empty row appears before the next static content. 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 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 "autohide header1 = yes", for example, would remove the need to perform the "#if" test so that we can just to define "header1 = Optional header"),
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 "autohide header1 = yes", for example, would remove the need to perform the "#if" test so that we can just to define "header1 = Optional header"),
Line 353: Line 353:
  |below = Below text
  |below = Below text
}}
}}
<pre style="overflow: auto">
<source lang="sass" highlight="3,9" style="overflow: auto">
{{Infobox
{{Infobox
  |name        = {{subst:PAGENAME}}
  |name        = {{subst:PAGENAME}}
Line 384: Line 384:
  |below = Below text
  |below = Below text
}}
}}
</pre>{{clear}}
</source>{{clear}}


== Embedding ==
== Embedding ==
<!--Linked from [[Template:Subinfobox bodystyle/doc]]-->
<!--Linked from [[Template:Subinfobox bodystyle/doc]]-->
One infobox template can be embedded into another using the {{para|child}} parameter. This feature can be used to create a modular infobox, or to create more well defined logical sections. Previously, it was necessary to use embedding in order to create infoboxes with more than 99 rows, but there is now no limit to the number of rows that can be defined in a single instance of <code><nowiki>{{infobox}}</nowiki></code>.
One infobox template can be embedded into another using the {{para|child}} parameter or the {{para|embed}} parameter. This feature can be used to create a modular infobox, or to create better-defined logical sections. Long ago, it was necessary to use embedding in order to create infoboxes with more than 99 rows; but nowadays there's no limit to the number of rows that can be defined in a single instance of <code><nowiki>{{infobox}}</nowiki></code>.


{{Infobox
{{Infobox
Line 494: Line 494:


Note that omitting the {{para|title}} parameter, and not including any text preceding the embedded infobox, may result in spurious blank table rows, creating gaps in the visual presentation.
Note that omitting the {{para|title}} parameter, and not including any text preceding the embedded infobox, may result in spurious blank table rows, creating gaps in the visual presentation.
[[Wikipedia:WikiProject Infoboxes/embed]] includes some links to Wikipedia articles which include infoboxes embedded within other infoboxes.


== Subboxes ==
== Subboxes ==
Line 517: Line 519:
  | header6 = Main 6
  | header6 = Main 6
}}
}}
<pre style="overflow:auto">
<source lang="sass" style="overflow:auto">
{{Infobox
{{Infobox
  | headerstyle = background-color:#eee;
  | headerstyle = background-color:#eee;
Line 537: Line 539:
  | header6 = Main 6
  | header6 = Main 6
}}
}}
</pre>{{clear}}
</source>{{clear}}


Similar embedding techniques may be used within content parameters of some other templates generating tables (such as [[:Template:Sidebar|Sidebar]]) :
Similar embedding techniques may be used within content parameters of some other templates generating tables (such as [[:Template:Sidebar|Sidebar]]) :
Line 559: Line 561:
  | heading5 = Heading 5
  | heading5 = Heading 5
}}
}}
<pre style="overflow:auto">
<source lang="sass" style="overflow:auto">
{{Sidebar
{{Sidebar
  | navbar = off
  | navbar = off
Line 578: Line 580:
  | heading5 = Heading 5
  | heading5 = Heading 5
}}
}}
</pre>{{clear}}
</source>{{clear}}


Note that the default padding of the parent data cell containing each subbox is still visible, so the subboxes are slightly narrower than the parent box and there's a higher vertical spacing between standard cells of the parent box than between cells of distinct subboxes.
Note that the default padding of the parent data cell containing each subbox is still visible, so the subboxes are slightly narrower than the parent box and there's a higher vertical spacing between standard cells of the parent box than between cells of distinct subboxes.
Line 674: Line 676:
|  data20 =  
|  data20 =  


| belowstyle    =
| belowstyle    =  
| below          =  
| below          =  
}}
}}
Line 689: Line 691:
* {{tl|Navbox}} and {{tl|Sidebar}}
* {{tl|Navbox}} and {{tl|Sidebar}}
* [[Wikipedia:List of infoboxes|List of infoboxes]]
* [[Wikipedia:List of infoboxes|List of infoboxes]]
* [[:Module:InfoboxImage]]
* Maintenance categories:
* Maintenance categories:
** [[:Category:Articles which use infobox templates with no data rows]]
** [[: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]]
** [[: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 | |
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox | |
[[Category:Infobox templates| ]]
[[Category:Infobox templates| ]]
[[Category:Wikipedia metatemplates|Infobox]]
[[Category:Wikipedia metatemplates|Infobox]]
[[Category:Templates generating microformats]]
[[Category:Templates generating microformats]]
[[Category:Lua-based infobox templates]]
}}</includeonly>
}}</includeonly>
==Tracking categories==
* {{clc|Articles with missing Wikidata information}}
Administrators, upwizcampeditors
0

edits