Template:Switch infobox

From the Tesseract Wiki, the wiki for all things Marvel Cinematic Universe
Jump to navigation Jump to search
Template documentation
This documentation is transcluded from Template:Switch infobox/doc. [edit] [history] [purge]
Template:Switch infobox invokes function main in Module:Switch infobox using Lua.

This template is used to separate different information on a specific page with different condition (For example, a real-world book and a fictitious one).

After the insertion of the template, there will be different buttons stating the possible conditions of that page. When clicked on different conditions, the page will display different information.

Note that switch infoboxes can have unintended interactions with other switch infoboxes, or with other infoboxes that contain multiple versions. You can specify your own switch_id's to mitigate this interaction (see #Specifying switch IDs below).

Usage

{{Switch infobox
|text1 = Name of condition 1
|item1 = Type information here which is shown in condition 1
|text2 = Name of condition 2
|item2 = Type information here which is shown in condition 2
|text3 = Name of condition 3
|item3 = Type information here which is shown in condition 3
}}

produces

Loading...
Name of condition 1Name of condition 2Name of condition 3
Type information here which is shown in condition 1
Type information here which is shown in condition 2
Type information here which is shown in condition 3

Specifying switch IDs

By default, each switch item uses an ID of 1, 2, 3, etc. Because all switch infoboxes and multi-version infoboxes use the same numerical ID by default, they all switch at the same time, which is often not intended. To avoid this issue, you can manually specify the ID for each item with the switch_id#, where # is the item number. These switch IDs can be specified to avoid conflicts with other switch infoboxes or multi-version infoboxes. The rules for specifying switch_id are:

  • switch_id can be text, including most special characters (although it's probably a good idea to keep it simple)
  • switch_id must not contain double-quotes (")
  • Do NOT use the same switch_id for multiple items in the same switch infobox. This causes both items to be shown when clicked and duplicates the switch buttons.

Note that if using switch_id's on a page containing a Template:Synced switch, you will probably want to specify nodefault=y in the sync switch. See the documentation on Template:Synced switch#No default switching and Template:Synced switch#Switch IDs for more detail.

Example usage:

{{Switch infobox
|text1 = 1: My switch ID is alt1
|switch_id1 = alt1
|item1 = Item 1: Note that this does not interact with the other example on this page.
|text2 = 2: My switch ID is alt2
|switch_id2 = alt2
|item2 = Item2: Note that this does not interact with the other example on this page.
}}

produces

Loading...
1: My switch ID is alt12: My switch ID is alt2
Item 1: Note that this does not interact with the other example on this page.
Item2: Note that this does not interact with the other example on this page.

Quick copy

Note: The template is not limited to 2 conditions only. Editors can add more conditions if available.

{{Switch infobox
|text1 = 
|item1 = 
|text2 = 
|item2 = 
}}