Template:Infobox: Difference between revisions

Want an adless experience? Log in or Create an account.
updated documentation to reflect removal of multicell/subcell and new max of 3 columns; removed TODO regarding Fan Games (change may have fixed it, I don't remember what was wrong and I don't see anything wrong)
m (Made "reward" tab plural)
(updated documentation to reflect removal of multicell/subcell and new max of 3 columns; removed TODO regarding Fan Games (change may have fixed it, I don't remember what was wrong and I don't see anything wrong))
Line 1: Line 1:
{{High Use}}{{TODO|fix release header display on [[Fan Games]]}}<onlyinclude><includeonly>{{#switch: {{lc:{{{1|}}}}}
{{High Use}}<onlyinclude><includeonly>{{#switch: {{lc:{{{1|}}}}}
| interview = {{Cat|Interviews|{{{2|{{PAGENAME}}}}}}}
| interview = {{Cat|Interviews|{{{2|{{PAGENAME}}}}}}}
| product | publication = {{Cat|Products|{{{2|{{PAGENAME}}}}}}}
| product | publication = {{Cat|Products|{{{2|{{PAGENAME}}}}}}}
Line 693: Line 693:
Headers can also be added using {{Usage|sub=Header|text}}. They should be surrounded by an 'if' function that checks for any parameters in the section to which the header refers. Check the existing code for examples.
Headers can also be added using {{Usage|sub=Header|text}}. They should be surrounded by an 'if' function that checks for any parameters in the section to which the header refers. Check the existing code for examples.


Rows support variable numbers of columns and variable numbers of labels. Each argument passed to Infobox/Row represents one column. To adjust which cells are represented as labels, use the <code>label</code> parameter. <code>label=0</code> makes the whole row data cells; <code>label=1</code> is the default value; <code>label=2</code> makes the first two cells labels; etc.
Each argument—up to three—passed to Infobox/Row represents one column. To adjust which cells are represented as labels, use the <code>label</code> parameter. <code>label=0</code> makes the whole row data cells; <code>label=1</code> is the default value; <code>label=2</code> makes the first two cells labels; etc.


Extra columns after the second one don't naturally line up with each other. To work around this, the widths of these columns can be defined using <code><nowiki>{{#vardefine:colNwidth|value}}</nowiki></code>, where <code>value</code> is the width in pixels (e.g. "50px") of the Nth column (i.e. define col3width for the third column, col4width for the fourth, etc.).
The widths of the columns can be defined using <code><nowiki>{{#vardefine:colNwidth|value}}</nowiki></code>, where <code>value</code> is the width (e.g. "50px") of the Nth column (i.e. define col3width for the third column). This can only be done once per column; once a cell has a defined width, further cells in the same column will share that width, even if the variable is reassigned.


===Demo===
===Demo===
Line 708: Line 708:
{{Infobox/Row|Label|Data}}
{{Infobox/Row|Label|Data}}
{{Infobox/Row|label=0|Colspan'd data}}
{{Infobox/Row|label=0|Colspan'd data}}
{{Infobox/Row||Improperly colspan'd data}}
{{Infobox/Row|Default|Three column|Behavior}}
{{Infobox/Row|Default|Three column|Behavior}}
{{#vardefine:col3width|100px}}
{{#vardefine:col3width|100px}}
Line 716: Line 715:
{{#vardefine:col3width|75px}}
{{#vardefine:col3width|75px}}
{{Infobox/Row|Different|Col|Width}}
{{Infobox/Row|Different|Col|Width}}
{{#vardefine:col4width|75px}}
{{Infobox/Row|Row|With|Four|Columns}}
{{Infobox/Row|THERE|ARE|FOUR|COLUMNS|}}
</table>
</table>
{{Box/Bottom}}
{{Box/Bottom}}
Line 729: Line 725:
{{Infobox/Row|Label|Data}}
{{Infobox/Row|Label|Data}}
{{Infobox/Row|label=0|Colspan'd data}}
{{Infobox/Row|label=0|Colspan'd data}}
{{Infobox/Row||Improperly colspan'd data}}
{{Infobox/Row|Default|Three column|Behavior}}
{{Infobox/Row|Default|Three column|Behavior}}
{{#vardefine:col3width|100px}}
{{#vardefine:col3width|100px}}
Line 735: Line 730:
{{Infobox/Row|label=2|Two|Labels|Data}}
{{Infobox/Row|label=2|Two|Labels|Data}}
{{Infobox/Row|label=3|Three|Label|Columns}}
{{Infobox/Row|label=3|Three|Label|Columns}}
{{#vardefine:col3width|75px}}
{{#vardefine:col3width|15px}}
{{Infobox/Row|Different|Col|Width}}
{{Infobox/Row|Different|Col|Width}}
{{#vardefine:col4width|75px}}
{{Infobox/Row|Row|With|Four|Columns}}
{{Infobox/Row|THERE|ARE|FOUR|COLUMNS|}}
</table>
</table>
{{Box/Bottom}}
{{Box/Bottom}}