Difference between revisions of "Template:Segmented control"

From Co-Optitude Wiki
Jump to navigation Jump to search
Line 8: Line 8:
 
<includeonly>
 
<includeonly>
 
{{#vardefine:segmentCount|0}}
 
{{#vardefine:segmentCount|0}}
{{#vardefine:i|1}}
+
{{#vardefine:i|0}}
 
{{#while:|{{#vardefine:segmentTitle|{{#explode:{{{Titles}}}|;|{{#var:i}} }} }}{{#var:segmentTitle}}
 
{{#while:|{{#vardefine:segmentTitle|{{#explode:{{{Titles}}}|;|{{#var:i}} }} }}{{#var:segmentTitle}}
 
   |<nowiki/>
 
   |<nowiki/>
* Title = {{#var:segmentTitle}}
+
  {{#vardefine:segmentImage|{{#explode:{{{Icons}}}|;|{{#var:i}} }} }}
 +
  {{#vardefine:segmentLink|{{#explode:{{{Links}}}|;|{{#var:i}} }} }}
 +
{{#if:{{#var:segmentLink}}|* [[{{#var:segmentLink}}|{{#if:{{#var:segmentImage}}|[[File:{{#var:segmentImage}}|20px|none|link=]] }}{{#var:segmentTitle}}]]|* {{#if:{{#var:segmentImage}}|[[File:{{#var:segmentImage}}|20px|none|link=]] }}{{#var:segmentTitle}}}}
 
   {{#vardefine:i|{{#expr:{{#var:i}}+1}}}}
 
   {{#vardefine:i|{{#expr:{{#var:i}}+1}}}}
 
}}
 
}}
 
</includeonly>
 
</includeonly>

Revision as of 18:50, 28 March 2020

Usage example:

{{SegmentedControl
  |Titles=Title 1;Title 2;Title 3}}