Difference between revisions of "Template:Legio Header"

From Australis Ultima 30k
Jump to: navigation, search
m (Example Working)
m
 
(21 intermediate revisions by the same user not shown)
Line 7: Line 7:
 
}}  
 
}}  
 
}}
 
}}
{{#ifexpr: {{#var:cyclecnt}} < 10  
+
{{#iferror: {{#expr: {{#var:cyclecnt}} + 1 }} |{{#vardefine:cyclecnt|0}}|}}
| {{#dpl:
+
{{#switch:{{#var:cyclecnt}}
 +
| 0 ={{ #vardefine: icc |{{#var:cyclecnt}}}}{{
 +
  #while:
 +
  | {{ #ifexpr: {{ #var: icc }} < 10 | true }}
 +
  |<div style="display:inline;">[[File:Legio Nil.png|bottom|link=|frameless|{{#var:msize}}|Empty]]</div>
 +
{{ #vardefine: icc | {{ #expr: {{ #var: icc }} + 1 }} }}
 +
}}
 +
|1|2|3|4|5|6|7|8|9 = {{#dpl:
 
|category =Player
 
|category =Player
|category ={{PAGENAME}}  
+
|category ={{PAGENAME}}
 
|notnamespace=Template
 
|notnamespace=Template
 
|include= {Infobox Army}:image
 
|include= {Infobox Army}:image
Line 22: Line 29:
 
{{ #vardefine: icc | {{ #expr: {{ #var: icc }} + 1 }} }}
 
{{ #vardefine: icc | {{ #expr: {{ #var: icc }} + 1 }} }}
 
}}
 
}}
| {{#dpl:
+
|{{#dpl:
 
|category =Player
 
|category =Player
|category =Legio II
+
|category ={{PAGENAME}}
 
|notnamespace=Template
 
|notnamespace=Template
 
|include= {Infobox Army}:image
 
|include= {Infobox Army}:image
Line 30: Line 37:
 
|format=,<div style="display:inline;">[[,|{{#var:msize}}|bottom|link=%PAGE%]]</div>
 
|format=,<div style="display:inline;">[[,|{{#var:msize}}|bottom|link=%PAGE%]]</div>
 
}}
 
}}
}}
+
}}</div><noinclude>
</div><noinclude>
+
 
=== Example Working ===
 
=== Example Working ===
 
<div id="mp-topbanner" style="width:100%; text-align:left; background:#F7F7F7; margin:0 0 0 0; border:0px solid #ddd;">{{#vardefine:msize|63px}}{{#vardefine:cyclecnt|{{#dpl:
 
<div id="mp-topbanner" style="width:100%; text-align:left; background:#F7F7F7; margin:0 0 0 0; border:0px solid #ddd;">{{#vardefine:msize|63px}}{{#vardefine:cyclecnt|{{#dpl:
 
|category =Player
 
|category =Player
|category =Legio II
+
|category =Legio I
 
|notnamespace=Template
 
|notnamespace=Template
 
|mode=userformat
 
|mode=userformat
Line 41: Line 47:
 
}}  
 
}}  
 
}}
 
}}
{{#ifexpr: {{#var:cyclecnt}} < 10  
+
{{#iferror: {{#expr: {{#var:cyclecnt}} + 1 }} |{{#vardefine:cyclecnt|0}}|}}
| {{#dpl:
+
{{#switch:{{#var:cyclecnt}}
 +
| 0 ={{ #vardefine: icc |{{#var:cyclecnt}}}}{{
 +
  #while:
 +
  | {{ #ifexpr: {{ #var: icc }} < 10 | true }}
 +
  |<div style="display:inline;">[[File:Legio Nil.png|bottom|link=|frameless|{{#var:msize}}|Empty]]</div>
 +
{{ #vardefine: icc | {{ #expr: {{ #var: icc }} + 1 }} }}
 +
}}
 +
|1|2|3|4|5|6|7|8|9 = {{#dpl:
 
|category =Player
 
|category =Player
|category =Legio II
+
|category =Legio I
 
|notnamespace=Template
 
|notnamespace=Template
 
|include= {Infobox Army}:image
 
|include= {Infobox Army}:image
Line 56: Line 69:
 
{{ #vardefine: icc | {{ #expr: {{ #var: icc }} + 1 }} }}
 
{{ #vardefine: icc | {{ #expr: {{ #var: icc }} + 1 }} }}
 
}}
 
}}
| {{#dpl:
+
|{{#dpl:
 
|category =Player
 
|category =Player
|category =Legio I  
+
|category =Legio I
 
|notnamespace=Template
 
|notnamespace=Template
 
|include= {Infobox Army}:image
 
|include= {Infobox Army}:image
Line 69: Line 82:
 
== Explanation==
 
== Explanation==
 
*The first DPL extract returns a count of the number of pages that are going to be returned in the Query and sets the variable "cyclecnt" to this number.
 
*The first DPL extract returns a count of the number of pages that are going to be returned in the Query and sets the variable "cyclecnt" to this number.
* The second block starts of by checking the value of "cyclecnt" if this is less than 10 then it runs through an alternate output which pushes a number of greyed out or place holder marine graphics along the top of the page such that the minimum number of marine icons across the top of the page is 10, mostly for aesthetic reasons.
+
*"cyclecnt" is then checked to confirm it is a number and the default dpl error message (indicating 0 results) hasn't be returned. If this is not a number than "cyclecnt" is set to 0
* If a Legio already has 10 armies present then simply the number of army graphics is displayed whether this is 10 or more.
+
* The next block is a 3 tier case statement(actually more but outcomes 1-9 resolve to the same endpoint) which evaluates against "cyclecnt":
   
+
** Case 0 - If "cyclecnt" is equal to 0 then no DPL extract is performed and simply 10 grey place holder marines are output using a while loop
 +
**Case(s) 1-9 - If "cyclecnt" is equal to 1-9 then the DPL is triggered and any remaining spaces upto 10 are filled with grey place holder marines again using the while loop.
 +
** Default - If "cyclecnt" is equal to 10 we need no placeholders and only the DPL extract is outputted.  
 +
 
 
</noinclude>
 
</noinclude>

Latest revision as of 04:06, 1 September 2014

Empty
Empty
Empty
Empty
Empty
Empty
Empty
Empty
Empty
Empty

Example Working

Blanche DA.jpg
Legio I.png
Legio Nil.png
Legio Nil.png
Legio Nil.png
DA Legionary Primaris 2.jpg
Legio Nil.png
Legio I.png
Legio Nil.png
Hh da by warbringervi-dalm316.jpg
VolkTroop.png
Legio Nil.png
Legio I.png
Legio I.png
Legio Nil.png

Explanation

  • The first DPL extract returns a count of the number of pages that are going to be returned in the Query and sets the variable "cyclecnt" to this number.
  • "cyclecnt" is then checked to confirm it is a number and the default dpl error message (indicating 0 results) hasn't be returned. If this is not a number than "cyclecnt" is set to 0
  • The next block is a 3 tier case statement(actually more but outcomes 1-9 resolve to the same endpoint) which evaluates against "cyclecnt":
    • Case 0 - If "cyclecnt" is equal to 0 then no DPL extract is performed and simply 10 grey place holder marines are output using a while loop
    • Case(s) 1-9 - If "cyclecnt" is equal to 1-9 then the DPL is triggered and any remaining spaces upto 10 are filled with grey place holder marines again using the while loop.
    • Default - If "cyclecnt" is equal to 10 we need no placeholders and only the DPL extract is outputted.