Template:Infobox: Difference between revisions

From Pirate Software Wiki
(rv. avoiding conditionals at the cost of template forking is bad. We will have them in MediaWiki anyway)
(Trying to implement an modular infobox)
Tag: Replaced
 
(167 intermediate revisions by 51 users not shown)
Line 1: Line 1:
{| class="infobox bordered" style="width: 25em; text-align: left; font-size: 95%;"
<includeonly>{{infobox start|{{{class|}}}}}
|+ style="font-size: larger;" | '''{{{name}}}'''
{{infobox header
|-
| name = {{{name|{{PAGENAME}}}}}
| colspan="2" style="text-align:center;" | [[Template:{{{image}}}|300px| ]]<br>{{{caption}}}
| wideimage = {{{image|{{{name|{{PAGENAME}}}}}.png}}}
|-
| description = {{{description|}}}
! Data 1:
}}
| {{{data1}}}
|-
! Data 2:
| {{{data2|''this text displayed if data2 not defined''}}}
|-
! Data 3 (data hidden if data3 empty or not defined):
| {{{data3|}}}
{{qif|test={{{data4|}}}|then=<tr><th>Data 4 (row hidden if data4 empty):<td>{{{data4}}} }}
{{qif|test={{{na{{{data5|}}}me|}}}|then=<tr><th>Data 5 (row hidden if data5 not empty):<td>{{{data5}}} }}
|-
| colspan="2" style="font-size: smaller;" | {{{footnotes|}}}
|}<noinclude>


<br style="clear:both" />
{{infobox section|{{#if:{{{section1|}}}|{{{section1}}}|Infos}}}}
== Usage ==
{{infobox row|{{{info1|}}}|{{{info1value|}}}|{{{info1value|}}}}}
Copy this code
{{infobox section|{{{section2}}}|{{{section2|}}}}}
 
{{infobox row|{{{info2|}}}|{{{info2value|}}}|{{{info2value|}}}}}
<pre>
{{infobox section|{{{section3}}}|{{{section3|}}}}}
{| class="infobox bordered" style="width: 25em; text-align: left; font-size: 95%;"
{{infobox row|{{{info3|}}}|{{{info3value|}}}|{{{info3value|}}}}}
|+ style="font-size: larger;" | '''{{{name}}}'''
{{infobox section|{{{section4}}}|{{{section4|}}}}}
|-
{{infobox row|{{{info4|}}}|{{{info4value|}}}|{{{info4value|}}}}}
| colspan="2" style="text-align:center;" | [[Template:{{{image}}}|300px| ]]<br>{{{caption}}}
{{infobox section|{{{section5}}}|{{{section5|}}}}}
|-
{{infobox row|{{{info5|}}}|{{{info5value|}}}|{{{info5value|}}}}}
! Data 1:
{{infobox section|{{{section6}}}|{{{section6|}}}}}
| {{{data1}}}
{{infobox row|{{{info6|}}}|{{{info6value|}}}|{{{info6value|}}}}}
|-
{{infobox section|{{{section7}}}|{{{section7|}}}}}
! Data 2:
{{infobox row|{{{info7|}}}|{{{info7value|}}}|{{{info7value|}}}}}
| {{{data2|''this text displayed if data2 not defined''}}}
{{infobox section|{{{section8}}}|{{{section8|}}}}}
|-
{{infobox row|{{{info8|}}}|{{{info8value|}}}|{{{info8value|}}}}}
! Data 3 (data hidden if data3 empty or not defined):
{{infobox section|{{{section9}}}|{{{section9|}}}}}
| {{{data3|}}}
{{infobox row|{{{info9|}}}|{{{info9value|}}}|{{{info9value|}}}}}
{{qif|test={{{data4|}}}|then=<tr><th>Data 4 (row hidden if data4 empty):<td>{{{data4}}} }}
{{infobox section|{{{section10}}}|{{{section10|}}}}}
{{qif|test={{{na{{{data5|}}}me|}}}|then=<tr><th>Data 5 (row hidden if data5 not empty):<td>{{{data5}}} }}
{{infobox row|{{{info10|}}}|{{{info10value|}}}|{{{info10value|}}}}}
! Data 5 (row hidden if data5 not empty):
{{infobox end}}</includeonly><noinclude>
| {{{data5}}}
{{doc}}
|-
[[Category:Infobox templates]]</noinclude>
| colspan="2" style="font-size: smaller;" | {{{footnotes|}}}
|}
</pre>
 
==See also==
*[[Wikipedia:Infobox]]
 
[[Category:infobox templates|{{PAGENAME}}]]
 
[[zh:Template:Infobox]]
</noinclude>

Latest revision as of 15:14, 29 November 2023

Documentation

This is a flexible generic infobox with customize-able fields. It is made using infobox parts. It is intended to be used in situations that require a one-time infobox that is not reused enough for a dedicated template. It is not intended to be a template called to make another infobox template. For information on how to make an infobox using these parts, observe this page's source code or see Template:Infobox example.

Usage

{{infobox
| class = 
| name = 
| image = 
| description = 
| section1 = 
| info1 = 
| info1value = 
| section2 = 
| info2 = 
| info2value = 
| section3 = 
| info3 = 
| info3value = 
| section4 = 
| info4 = 
| info4value = 
| section5 = 
| info5 = 
| info5value = 
| section6 = 
| info6 = 
| info6value = 
| section7 = 
| info7 = 
| info7value = 
}}

Parameters

  • class - Optional. Adds a second class to the infobox, allowing for customizing individual or groups of infoboxes. See Template:Infobox start/doc for more info.
  • image - Images should be formatted as image.jpg. The [[ ]] and File: are not necessary.

Example

Fire
Main Info
Race Plushie
Source Banana
Other Info
Related Fun
{{Infobox
| name       = Fire
| image      = Thor.png
| section1   = Main Info
| info1      = Race
| info1value = Plushie
| info2      = Location
| info2value = 
| info3      = Source
| info3value = Banana
| info4      = Reward
| info4value = 
| section5   = Other Info
| info5      = Related
| info5value = Fun
| info6      = ID
| info6value =
}}