From GamingWiki
m (Protected "Template:Navbox": High traffic page ([edit=sysop] (indefinite) [move=sysop] (indefinite))) |
|||
(25 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
Please do not edit without discussion first as this is a VERY complex template. | Please do not edit without discussion first as this is a VERY complex template. | ||
+ | |||
+ | |||
+ | Some basic box information | ||
+ | number of groups/rows | ||
+ | -->{{#vardefine:numrows|0}}<!-- | ||
+ | We may have a 'groups' parameter or 'group1', 'group2', ... | ||
+ | -->{{#if: {{{groups|}}}<!-- | ||
+ | -->|<!-- one parameter | ||
+ | -->{{#vardefine:groupidx|1}}<!-- | ||
+ | -->{{#while: | {{#vardefineecho: thegroup| {{#explode: {{{groups}}} | ;; | {{#var:groupidx}} }} }}<!-- | ||
+ | -->|<!-- | ||
+ | -->{{#vardefine: gnum | {{#explode: {{#var:thegroup}} | // | 0}} }}<!-- | ||
+ | -->{{#vardefine: group{{#var:gnum}} | {{#explode: {{#var:thegroup}} | // | 1}} }}<!-- | ||
+ | -->{{#ifexpr: {{#var:gnum}} > {{#var:numrows}} | {{#vardefine: numrows | {{#var:gnum}} }} }}<!-- | ||
+ | -->{{#vardefine: groupidx | {{#expr: {{#var: groupidx}} + 1}} }}<!-- | ||
+ | -->}}<!-- | ||
+ | -->|<!-- many parameters (potentially) | ||
+ | -->}}<!-- | ||
+ | We may have a 'lists' parameter or 'list1', 'list2', ... | ||
+ | -->{{#if: {{{lists|}}}<!-- | ||
+ | -->|<!-- one parameter | ||
+ | -->{{#vardefine:listidx|1}}<!-- | ||
+ | -->{{#while: | {{#vardefineecho: thelist| {{#explode: {{{lists}}} | ;; | {{#var:listidx}} }} }}<!-- | ||
+ | -->|<!-- | ||
+ | -->{{#vardefine: lnum | {{#explode: {{#var:thelist}} | // | 0}} }}<!-- | ||
+ | -->{{#vardefine: list{{#var:lnum}} | {{#explode: {{#var:thelist}} | // | 1}} }}<!-- | ||
+ | -->{{#ifexpr: {{#var:lnum}} > {{#var:numrows}} | {{#vardefine: numrows | {{#var:lnum}} }} }}<!-- | ||
+ | -->{{#vardefine: listidx | {{#expr: {{#var: listidx}} + 1}} }}<!-- | ||
+ | -->}}<!-- | ||
+ | -->|<!-- many parameters (potentially) | ||
+ | -->}}<!-- | ||
-->{{#switch:{{{border|{{{1|}}}}}}|subgroup|child=</div>|none=|#default=<table class="navbox {{{bodyclass|}}}" cellspacing="0" <!-- | -->{{#switch:{{{border|{{{1|}}}}}}|subgroup|child=</div>|none=|#default=<table class="navbox {{{bodyclass|}}}" cellspacing="0" <!-- | ||
Line 11: | Line 42: | ||
-->#default=" style="width:100%;background:transparent;color:inherit}};{{{innerstyle|}}};"><!-- | -->#default=" style="width:100%;background:transparent;color:inherit}};{{{innerstyle|}}};"><!-- | ||
− | + | -->{{#vardefine: columns | {{#expr:2{{#if:{{{imageleft|}}}|+1}}{{#if:{{{image|}}}|+1}}}} }}<!-- | |
---Title and Navbar--- | ---Title and Navbar--- | ||
Line 17: | Line 48: | ||
--><td class="navbox-group" style="{{{basestyle|}}};{{{groupstyle|}}};{{{titlegroupstyle|}}}">{{{titlegroup|}}}</td><!-- | --><td class="navbox-group" style="{{{basestyle|}}};{{{groupstyle|}}};{{{titlegroupstyle|}}}">{{{titlegroup|}}}</td><!-- | ||
--><th style="border-left:2px solid #fdfdfd;width:100%;|<th style="}}{{{basestyle|}}};{{{titlestyle|}}}" <!-- | --><th style="border-left:2px solid #fdfdfd;width:100%;|<th style="}}{{{basestyle|}}};{{{titlestyle|}}}" <!-- | ||
− | -->colspan={{#expr: | + | -->colspan={{#expr:{{#var:columns}}{{#if:{{{titlegroup|}}}|-1}}}} <!-- |
-->class="navbox-title"><!-- | -->class="navbox-title"><!-- | ||
Line 31: | Line 62: | ||
-->{{{title}}}</span></th></tr>}}<!-- | -->{{{title}}}</span></th></tr>}}<!-- | ||
+ | |||
+ | DEBUG | ||
+ | --><!--{{#tag:pre| | ||
+ | groups: {{{groups}}} | ||
+ | lists: {{{lists}}} | ||
+ | title1: {{{title1}}} | ||
+ | body1: {{{body1}}} | ||
+ | group1 var: {{#var:group1}} | ||
+ | list1 var: {{#var:list1}} | ||
+ | numrows: {{#var:numrows}} | ||
+ | }}--><!-- | ||
Line 37: | Line 79: | ||
-->{{#if:{{{title|}}}|<tr style="height:2px;"><td></td></tr>}}<!-- | -->{{#if:{{{title|}}}|<tr style="height:2px;"><td></td></tr>}}<!-- | ||
--><tr><td class="navbox-abovebelow" style="{{{basestyle|}}};{{{abovestyle|}}}" <!-- | --><tr><td class="navbox-abovebelow" style="{{{basestyle|}}};{{{abovestyle|}}}" <!-- | ||
− | -->colspan="{{#expr: | + | -->colspan="{{#expr:{{#var:columns}}}}">{{{above}}}</td></tr>}}<!-- |
+ | DEBUG | ||
+ | --><!--<pre>---Body---</pre>--><!-- | ||
---Body--- | ---Body--- | ||
− | + | -- Deal with image considerations -- | |
− | + | -->{{#vardefine: doimageleft | {{{imageleft|}}} }}<!-- | |
− | + | -->{{#vardefine: doimageright | {{{image|}}} }}<!-- | |
− | + | -->{{#vardefine: imgrowspan | {{#expr:{{#var:numrows}}*2 }} }}<!-- | |
− | -- | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | -->{{# | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | DEBUG | ||
+ | --><!--<pre>--- all rows ---</pre>--><!-- | ||
---Remaining groups/lists--- | ---Remaining groups/lists--- | ||
− | -->{{# | + | -->{{#loop: nboxD|1|{{#var: numrows}}<!-- |
− | |||
-->|<!-- | -->|<!-- | ||
− | |||
− | -->{{#if:{{ | + | -->{{#vardefine: modtwo | {{#expr: ({{#var:nboxD}} {{#ifeq:{{{evenodd|}}}|swap|+1|}}) mod 2 }} }}<!-- |
− | -->|<!-- | + | -->{{#vardefine: parity | {{#ifeq: {{#var:modtwo}} | 1 | odd | even }} }}<!-- |
− | -->{{#if:{{{title|}}}{{{above|}}}{{ | + | |
− | -->{{#if:{{{group{{#var:nboxD} | + | -->{{#if:{{#var: list{{#var:nboxD}}}}{{#var:group{{#var:nboxD}}}}<!-- |
+ | -->|<!-- a list or group exists | ||
+ | -->{{#if:{{{title|}}}{{{above|}}}{{#var:list1}}|<tr style="height:2px"><td></td></tr>}}<tr><!-- | ||
+ | -->{{#if:{{#var:doimageleft}}|<!-- | ||
+ | --><td style="width:0%;padding:0px 2px 0px 0px;{{{imageleftstyle|}}}" <!-- | ||
+ | -->rowspan="{{#var:imgrowspan}}"><!-- | ||
+ | -->{{#doimageleft}}</td><!-- | ||
+ | -->{{#vardefine: doimageleft|}}<!-- | ||
+ | -->}}<!-- | ||
+ | -->{{#if:{{#var:group{{#var:nboxD}}}}<!-- | ||
-->|<!-- add a group header cell | -->|<!-- add a group header cell | ||
--><td class="navbox-group" style="<!-- | --><td class="navbox-group" style="<!-- | ||
Line 92: | Line 120: | ||
-->{{{groupstyle|}}};<!-- | -->{{{groupstyle|}}};<!-- | ||
-->{{{group{{#var:nboxD}}style|}}}"><!-- | -->{{{group{{#var:nboxD}}style|}}}"><!-- | ||
− | -->{{ | + | -->{{#var:group{{#var:nboxD}}}}</td><!-- |
--><td style="text-align:left;border-left-width:2px;border-left-style:solid;<!-- | --><td style="text-align:left;border-left-width:2px;border-left-style:solid;<!-- | ||
-->|<!-- no group | -->|<!-- no group | ||
Line 101: | Line 129: | ||
-->{{#if:{{{groupwidth|}}}||width:100%;}}<!-- | -->{{#if:{{{groupwidth|}}}||width:100%;}}<!-- | ||
-->{{{liststyle|}}};<!-- | -->{{{liststyle|}}};<!-- | ||
− | -->{{{{{#var:parity}}style|}}};<!-- | + | -->{{{ {{#var:parity}}style|}}};<!-- |
-->{{{list{{#var:nboxD}}style|}}}<!-- | -->{{{list{{#var:nboxD}}style|}}}<!-- | ||
-->" <!-- | -->" <!-- | ||
-->class="navbox-list navbox-{{#var:parity}}"><!-- | -->class="navbox-list navbox-{{#var:parity}}"><!-- | ||
--><div style="padding:{{{listpadding|0em 0.25em}}}"><!-- | --><div style="padding:{{{listpadding|0em 0.25em}}}"><!-- | ||
− | -->{{Array Map | array = {{ | + | -->{{Array Map <!-- |
− | --></div></td></tr><!-- | + | -->| array = {{#var:list{{#var:nboxD}}}} <!-- |
− | -->}}<!-- end if list exists | + | -->| countfrom = 0 <!-- |
+ | -->| separator = :: <!-- | ||
+ | -->| after = {{·}} <!-- | ||
+ | -->| afterlast = <!-- | ||
+ | -->}}<!-- | ||
+ | --></div></td><!-- | ||
+ | -->{{#if:{{#var:doimageright}}|<!-- | ||
+ | --><td style="width:0%;padding:0px 0px 0px 2px;{{{imagestyle|}}}" <!-- | ||
+ | -->rowspan="{{#var:imgrowspan}}"><!-- | ||
+ | -->{{#var:doimageright}}</td><!-- | ||
+ | -->{{#vardefine: doimageright|}}<!-- | ||
+ | -->}}<!-- | ||
+ | --></tr><!-- | ||
+ | -->}}<!-- end if list or group exists | ||
+ | -->}}<!-- end loop | ||
− | |||
Line 117: | Line 158: | ||
-->{{#if:{{{title|}}}{{{above|}}}{{{list1|}}}{{{list2|}}}{{{list3|}}}|<tr style="height:2px;"><td></td></tr>}}<!-- | -->{{#if:{{{title|}}}{{{above|}}}{{{list1|}}}{{{list2|}}}{{{list3|}}}|<tr style="height:2px;"><td></td></tr>}}<!-- | ||
--><tr><td class="navbox-abovebelow" style="{{{basestyle|}}};{{{belowstyle|}}}" <!-- | --><tr><td class="navbox-abovebelow" style="{{{basestyle|}}};{{{belowstyle|}}}" <!-- | ||
− | -->colspan="{{#expr: | + | -->colspan="{{#expr:{{#var:columns}}}}">{{{below}}}</td></tr>}}<!-- |
Latest revision as of 01:30, 28 April 2011
[create]
Error creating thumbnail: File missing
Template documentation Editors can experiment in this template's sandbox (create) and testcases (create) pages. Please add categories and interwikis to the /doc subpage. Subpages of this template. |