Difference between revisions of "Template:Segmented control"

From Co-Optitude Wiki
Jump to navigation Jump to search
Line 17: Line 17:
 
     {{#vardefine:segmentLink|{{#explode:{{{Links|}}}|;|{{#var:i}} }} }}
 
     {{#vardefine:segmentLink|{{#explode:{{{Links|}}}|;|{{#var:i}} }} }}
 
     {{#vardefine:segmentClasses|rsSegment {{#if:{{#var:segmentLink}}|rsSegmentSelected}}}}
 
     {{#vardefine:segmentClasses|rsSegment {{#if:{{#var:segmentLink}}|rsSegmentSelected}}}}
     {{#vardefine:segmentIconHTML|{{#if:{{#var:segmentImage}}|[[Media:{{#var:segmentImage}}]]}}}}
+
     {{#vardefine:segmentIconHTML|{{#if:{{#var:segmentImage}}|{{filepath:{{#var:segmentImage}}}}}}}}
 
     {{#vardefine:segmentFillHTML|(fill: {{#var:segmentIconHTML}} (title: {{#var:segmentTitle}} :title) :fill)}}
 
     {{#vardefine:segmentFillHTML|(fill: {{#var:segmentIconHTML}} (title: {{#var:segmentTitle}} :title) :fill)}}
 
     (segment classes="{{#var:segmentClasses}}": {{#if:{{#var:segmentLink}}|[[{{#var:segmentLink}}|{{#var:segmentFillHTML}}]]|{{#var:segmentFillHTML}}}} :segment)
 
     (segment classes="{{#var:segmentClasses}}": {{#if:{{#var:segmentLink}}|[[{{#var:segmentLink}}|{{#var:segmentFillHTML}}]]|{{#var:segmentFillHTML}}}} :segment)

Revision as of 19:57, 28 March 2020

Usage example:

{{SegmentedControl
  |Titles=Title 1;Title 2;Title 3
  |Icons=Icon-name.png;;Icon-name.png
  |Links=Name of page;Name of page;}}

Segments without links will be assumed to be selected. Missing icons will show segments without icons.