Template:Alternative/sandbox
Jump to navigation
Jump to search
{{{default}}}
This is the template sandbox page for Template:Alternative (diff). See also the companion subpage for test cases. |
This template should always be substituted (i.e., use {{subst:Alternative}}). |
Contents
Usage
This template is used to add an alternative option to an existing template. Once this template is used, the alternative option will be available by setting the alt
parameter equal to yes
. (|alt=yes
).
Parameters
- Default: The information to be displayed when the
alt
parameter is omitted or set to anything but yes. - Alternative: The information to be used when the
alt
parameter is set to yes.
Examples
In order to use this template, it must be substed into another. For this example, that will be Template:Alternative/example. First, one would type the following code into that page:
Bob said "{{subst:alternative|default=hello|alternative=goodbye}}."
After the page is saved, the page's code would read:
Bob said "{{#ifeq:{{{alt}}}|yes|goodbye|hello}}."
Then, when transcluding that page without the alt option (typed as {{Alternative/example}}
), the following text would be displayed:
Bob said "hello."
Or, when transcluding with alt=yes
(typed as {{Alternative/example|alt=yes}}
, one would receive:
Bob said "goodbye."
See also
- The similar {{barnalt}} template.
The above documentation is transcluded from Template:Alternative/doc. (edit | history) Editors can experiment in this template's sandbox (edit | diff) and testcases (edit) pages. Please add categories to the /doc subpage. Subpages of this template. |