Template:Infobox: Difference between revisions

From Elwiki
mNo edit summary
mNo edit summary
 
(18 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<includeonly>{{#if:{{{color|}}}
<includeonly>{{#if:{{{colset|}}}
|{{#vardefine:color| background-color: {{{color}}};}}
| {{#vardefine:colset|{{{colset|}}}}}
}}<table class="infobox {{{class|}}}" style="{{{style|}}}">
| {{#vardefine:colset|1}}
<tr style="{{#var:color|}}" class="textfloat">
}}{{#switch:{{{color|}}}
<th class="title" colspan="{{#expr:{{{colset|1}}}+1}}">{{{title|}}}</th>
| ={{#vardefine:color| background-color: lightblue;}}
| Rainbow={{#vardefine:rainbow|rainbow}}
| #default ={{#vardefine:color| background-color: {{{color}}};}}  
}}<table style="{{{style|}}}" class="infobox {{{class|}}}">
<tr style="{{#var:color|}}" class="textfloat {{#var:rainbow|}}">
<th class="title" colspan="{{#expr:{{#var:colset|1}}+1}}">{{{title|}}}</th>
   </tr>
   </tr>
   {{#if:{{{image|}}}
   {{#if:{{{image|}}}
   |<tr>
   |<tr>
     <td class="image" colspan="{{#expr:{{{colset|1}}}+1}}"><center>{{{image}}}</center></td>
     <td class="image" colspan="{{#expr:{{#var:colset|1}}+1}}">{{{image}}}</td>
   </tr>
   </tr>
   }}
   }}
Line 15: Line 20:
|
|
{{#if:{{{set{{#var:key|}}|}}}
{{#if:{{{set{{#var:key|}}|}}}
| {{#vardefine:div|{{#expr:{{{colset|1}}}/{{{set{{#var:key|1}}|}}}}}}}
| {{#vardefine:div|{{#expr:{{#var:colset|1}}/{{{set{{#var:key|1}}|}}}}}}}
<tr class="entry">
<tr class="entry">
<th>{{#var:val|}}</th>
<th>{{#var:val|}}</th>
Line 28: Line 33:
     |<tr class="entry">
     |<tr class="entry">
     <th>{{#var:val|}}</th>
     <th>{{#var:val|}}</th>
<td colspan="{{{colset|1}}}">{{{data{{#var:key|}}|}}}</td>
<td colspan="{{#var:colset|1}}">{{{data{{#var:key|}}|}}}</td>
</tr>
</tr>
}}
}}
}}
}}
}}
}}
</table></includeonly></noinclude>
</table></includeonly><noinclude>{{DISPLAYTITLE:Infobox Prototype}}
{{DISPLAYTITLE:Infobox Prototype}}
== Description ==
== Description ==
This is infobox proto. All infoboxes should use this proto.
This is infobox proto. All infoboxes should use this proto.
== How to Use ===
== How to Use ==
<u>'''Valid Parameters'''</u>:
<u>'''Valid Parameters'''</u>:
:* '''Content Parameters''': <code>title</code>, <code>image</code>, <code>label???</code>, <code>data???</code>
:* '''Content Parameters''': <code>title</code>, <code>image</code>, <code>label???</code>, <code>data???</code>
:* '''Layout Parameters''': <code>colset</code>, <code>set???</code>
:* '''Layout Parameters''': <code>colset</code>, <code>set???</code>
:* '''Styling Parameters''': <code>style</code>, <code>class</code>, <code>color</code>
:* '''Styling Parameters''': <code>style</code>, <code>class</code>, <code>color</code>
== How it works ==
<u>'''Parameter Instructions'''</u>
# <code>title</code> and <code>image</code> are optional.
:* <code>title</code>: (Optional) The heading. Omitting will result in a thin line.
#* If <code>title</code> is omitted, the title bar will show as a line.
:* <code>image</code>: (Optional) The image on the top.
#* If <code>image</code> is omitted, the image part will disappear.
:* <code>label???</code>: Heading of entry. '''Required''' for entry.
# Every entry is composed of a <code>label???</code> and <code>data???</code>, and modified by <code>set???</code> and <code>colset</code>.
:* <code>data???</code>: Data of entry. '''Required''' for entry.
#* In most cases, the <code>???</code> should be the same for the same entry.
:* <code>set???</code>: (Optional) Number of entry columns (label does not count).
#* A <code>label???</code> is required to add an entry.
:* <code>colset</code>: (Optional) '''Required''' only if having <code>set???</code>, the [[Template:PRODUCT|product]] of <code>set</code> numbers in the whole infobox.
#** If the <code>set???</code> is set for this <code>label</code>, it will add a multiple-column entry.
:* <code>style</code>: (Optional) Style of in infobox, following CSS syntax.
#*** When adding a multiple-column entry, <code>set???</code> is how many columns in the entry (label of the entry not included).
:* <code>class</code>: (Optional) Class of infobox, following HTML <code>class</code> attribute syntax.
#*** Also, when adding a multiple-column entry, <code>colset</code> should be set to the product of all possible column numbers.
:* <code>color</code>: (Optional) Color of the heading. Default uses wikiskin default.
#**** For example, if you have 2 column entry, 3 column entry, and 5 column entry in the whole infobox, you should set <code>colset</code> to 30 (2 x 3 x 5).
<u>'''Other Notes'''</u>
#**** You can also use [[Template:PRODUCT]] to calculate the product.
:* Both <code>label???</code> and <code>data???</code> is required to add an entry.
#*** For multiple-column entries, you should write <code>data</code> as <code>data???/???</code>. For example, if you have <code>label30</code> and <code>set30</code>, you should write <code>data30/1</code>, <code>data30/2</code>, etc.
:** <code>set???</code> is required to add an multiple-column entry.
#** Otherwise, it will add a single-column entry.
:** If you are adding a multiple-column entry, the <code>data</code> should be written as <code>data???/...</code>.
:** In this case, if <code>data</code> is omitted, a entry will still be added.
:* <code>colset</code> can also be least common multiple (LCM), just make sure the <code>set???</code> is fractional to <code>colset</code>
</noinclude>
</noinclude>

Latest revision as of 14:41, 2 February 2018

Description

This is infobox proto. All infoboxes should use this proto.

How to Use

Valid Parameters:

  • Content Parameters: title, image, label???, data???
  • Layout Parameters: colset, set???
  • Styling Parameters: style, class, color

Parameter Instructions

  • title: (Optional) The heading. Omitting will result in a thin line.
  • image: (Optional) The image on the top.
  • label???: Heading of entry. Required for entry.
  • data???: Data of entry. Required for entry.
  • set???: (Optional) Number of entry columns (label does not count).
  • colset: (Optional) Required only if having set???, the product of set numbers in the whole infobox.
  • style: (Optional) Style of in infobox, following CSS syntax.
  • class: (Optional) Class of infobox, following HTML class attribute syntax.
  • color: (Optional) Color of the heading. Default uses wikiskin default.

Other Notes

  • Both label??? and data??? is required to add an entry.
    • set??? is required to add an multiple-column entry.
    • If you are adding a multiple-column entry, the data should be written as data???/....
    • In this case, if data is omitted, a entry will still be added.
  • colset can also be least common multiple (LCM), just make sure the set??? is fractional to colset