Difference between revisions of "Template:Infobox/row"
J McKalling (Talk | contribs) |
J McKalling (Talk | contribs) (added infobox) |
||
(51 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | <includeonly>{{#if: {{{header|}}}{{{data|}}} | + | <includeonly>{{#if: {{{header|}}}{{{data|}}}| |
− | |<tr> | + | <tr> |
{{#if: {{{header|}}} | {{#if: {{{header|}}} | ||
− | |<th colspan="2" class="{{{class|subtitle}}}">{{{header}}}</th> | + | |<th colspan="2" class="{{ |
+ | #if: {{{class|}}} | {{{class}}} | subtitle}} {{#ifeq: {{{class|}}} | title | {{{titleclass|}}} }}" style="{{ | ||
+ | #ifeq: {{lc:{{{class|}}}}} | title | {{{titlestyle|}}} | {{{headstyle|}}} }}">{{{header}}}</th> | ||
|{{#if: {{{label|}}} | |{{#if: {{{label|}}} | ||
− | |<th>{{{label}}}</th><td | + | |<th style="{{{headstyle|}}}">{{{label}}}</th><td |
− | |<td colspan="2"}} {{#if: {{{ | + | |<td colspan="2"}} class="{{#if:{{{label|}}}|data}} {{#if: {{{class|}}}|{{{class}}}}}" style="{{{datastyle|}}}"> |
− | + | {{{data}}} | |
+ | </td> }} | ||
</tr> | </tr> | ||
+ | }}</includeonly><noinclude>{{Infobox Template | ||
+ | |purpose=infobox | ||
+ | |singletag=no | ||
+ | |multiline=optional | ||
+ | |gamerelated=no | ||
+ | |suppressible= | ||
+ | |choice= | ||
+ | |cat1= | ||
+ | |var1= | ||
}} | }} | ||
− | + | ||
− | + | This template is used by [[Template:Infobox]] to add a row to a table. A row can be a full-row header, a half-row label with data, or a (multi-line) data-only row. | |
− | + | ||
− | + | To use this template, to be able to add rows to a table, there should be <tt><nowiki><table>...</table></nowiki></tt> tags surrounding it. The infobox does this automatically though. It also automatically calls this template appropriately. So it isn't necessary to call this template directly, but this page describes how it works regardless. | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | This template is used by [[Template:Infobox]] to add a row to | + | |
==Parameters== | ==Parameters== | ||
− | * '''header''': | + | These parameters procide the row with structure: |
− | * '''label''': | + | * '''header''': Specifying this parameter makes this row a header, and further ignores any '''data''' or '''label''' (case sensitive, defaults to non-header row) |
− | * '''data''': | + | * '''label''': Specifying this parameter if the row isn't a header, adds a half-row label in front of the '''data''' (case sensitive, defaults to data-only row) |
− | * '''class''': | + | * '''data''': Specify this parameter to make the row display data, if it isn't a header row (case sensitive, defaults to nothing displayed) |
+ | * '''class''': The class of the header tablecell if the row is a header, or the data tablecell otherwise (case sensitive, defaults to "subtitle" for header, or no specific class for data) | ||
+ | |||
+ | These parameters provide the row with theme-specific styles: | ||
+ | * '''titlestyle''': This style is used when the row specifies a '''header''' and '''class''' "title" (CSS statements, optional) | ||
+ | * '''headstyle''': This style is used for '''headers''' and '''label'''s (CSS statements, optional) | ||
+ | * '''datastyle''': This style is used for '''data''' cells (CSS statements, optional) | ||
+ | |||
+ | |||
+ | '''''Note:''' When neither '''data''' nor '''header''' are specified, the row will fully collapse and ignore any other specified values.'' | ||
+ | |||
+ | '''''Note:''' Even if the '''header''' parameter is used, the row will still have similar style as the half-row label with data, albeit full-row without data, unless it is paired with the 'subtitle' class.'' | ||
+ | |||
+ | '''''Note:''' The '''data''' may contain multiple lines of text, but if the '''label''' is also specified, the label will render stretched across the height of the data. So only specify a label if the data contains just a single line.'' | ||
==Syntax== | ==Syntax== | ||
+ | When specifying a header row, use this syntax: | ||
+ | <nowiki>{{Infobox/row | ||
+ | |header=some header text | ||
+ | |class=subtitle | ||
+ | }}</nowiki> | ||
+ | |||
+ | Otherwise, when specifying a row that contains data: | ||
+ | <nowiki>{{Infobox/row | ||
+ | |label=some optional label text | ||
+ | |data=text | ||
+ | |class= | ||
+ | }}</nowiki> | ||
==Examples== | ==Examples== | ||
+ | To show how the different uses of this template work out, the following is a simple example of an infobox using rows in various ways. The actual [[Template:Infobox|Infobox]] is a little more complex, but it all comes down to this: | ||
+ | <table class="infobox side land"> | ||
+ | {{Infobox/row |header=Twinsun |class=title}} | ||
+ | {{Infobox/row |label=Example? |data=Yes, of cource!}} | ||
+ | {{Infobox/row |label=Theme |data=Land}} | ||
+ | {{Infobox/row |header=Some Tests |class=subtitle}} | ||
+ | {{Infobox/row |header=Header no class}} | ||
+ | {{Infobox/row |header=Header with data |data=Invisible?!}} | ||
+ | {{Infobox/row |label=Tall label |data=Does this<br>look<br>Right?}} | ||
+ | {{Infobox/row |label=Hello |data=world!}} | ||
+ | {{Infobox/row |data=This is a better way<br>of showing multiple lines,<br>just a data-only row.}} | ||
+ | </table> | ||
+ | <nowiki><table class="infobox side land"> | ||
+ | {{Infobox/row |header=Twinsun |class=title}} | ||
+ | {{Infobox/row |label=Example? |data=Yes, of cource!}} | ||
+ | {{Infobox/row |label=Theme |data=Land}} | ||
+ | {{Infobox/row |header=Some Tests |class=subtitle}} | ||
+ | {{Infobox/row |header=Header no class}} | ||
+ | {{Infobox/row |header=Header with data |data=Invisible?!}} | ||
+ | {{Infobox/row |label=Tall label |data=Does this<br>look<br>Right?}} | ||
+ | {{Infobox/row |label=Hello |data=world!}} | ||
+ | {{Infobox/row |data=This is a better way<br>of showing multiple lines,<br>just a data-only row.}} | ||
+ | </table></nowiki> | ||
− | |||
</noinclude> | </noinclude> |
Latest revision as of 21:59, 4 June 2014
Infobox/row | |
---|---|
Purpose |
Infobox [list all] |
Single tag |
No [list all] |
Multi-line |
Optional [list all] |
Protected |
No [list all] |
Game related |
No [list all] |
Categorization | |
Categories |
none [list all] |
Variables | |
Names |
none [list all] |
Subpages |
This template is used by Template:Infobox to add a row to a table. A row can be a full-row header, a half-row label with data, or a (multi-line) data-only row.
To use this template, to be able to add rows to a table, there should be <table>...</table> tags surrounding it. The infobox does this automatically though. It also automatically calls this template appropriately. So it isn't necessary to call this template directly, but this page describes how it works regardless.
Parameters
These parameters procide the row with structure:
- header: Specifying this parameter makes this row a header, and further ignores any data or label (case sensitive, defaults to non-header row)
- label: Specifying this parameter if the row isn't a header, adds a half-row label in front of the data (case sensitive, defaults to data-only row)
- data: Specify this parameter to make the row display data, if it isn't a header row (case sensitive, defaults to nothing displayed)
- class: The class of the header tablecell if the row is a header, or the data tablecell otherwise (case sensitive, defaults to "subtitle" for header, or no specific class for data)
These parameters provide the row with theme-specific styles:
- titlestyle: This style is used when the row specifies a header and class "title" (CSS statements, optional)
- headstyle: This style is used for headers and labels (CSS statements, optional)
- datastyle: This style is used for data cells (CSS statements, optional)
Note: When neither data nor header are specified, the row will fully collapse and ignore any other specified values.
Note: Even if the header parameter is used, the row will still have similar style as the half-row label with data, albeit full-row without data, unless it is paired with the 'subtitle' class.
Note: The data may contain multiple lines of text, but if the label is also specified, the label will render stretched across the height of the data. So only specify a label if the data contains just a single line.
Syntax
When specifying a header row, use this syntax:
{{Infobox/row |header=some header text |class=subtitle }}
Otherwise, when specifying a row that contains data:
{{Infobox/row |label=some optional label text |data=text |class= }}
Examples
To show how the different uses of this template work out, the following is a simple example of an infobox using rows in various ways. The actual Infobox is a little more complex, but it all comes down to this:
Twinsun | |
---|---|
Example? |
Yes, of cource! |
Theme |
Land |
Some Tests | |
Header no class | |
Header with data | |
Tall label |
Does this |
Hello |
world! |
This is a better way |
<table class="infobox side land"> {{Infobox/row |header=Twinsun |class=title}} {{Infobox/row |label=Example? |data=Yes, of cource!}} {{Infobox/row |label=Theme |data=Land}} {{Infobox/row |header=Some Tests |class=subtitle}} {{Infobox/row |header=Header no class}} {{Infobox/row |header=Header with data |data=Invisible?!}} {{Infobox/row |label=Tall label |data=Does this<br>look<br>Right?}} {{Infobox/row |label=Hello |data=world!}} {{Infobox/row |data=This is a better way<br>of showing multiple lines,<br>just a data-only row.}} </table>