Difference between revisions of "Template:Alternative/doc"

From blackwiki
Jump to navigation Jump to search
blackwiki>Mclay1
m (update)
m (10 revisions imported)
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
{{Documentation subpage}}
 
{{Documentation subpage}}
 
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->
 
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->
This template '''must''' be substituted.
+
{{subst only}}
 
=== Usage ===
 
=== 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 <code>alt</code> parameter equal to <code>yes</code>. (<code>|alt=yes</code>).
 
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 <code>alt</code> parameter equal to <code>yes</code>. (<code>|alt=yes</code>).
Line 17: Line 17:
 
{{Alternative/example}}
 
{{Alternative/example}}
  
Or, when transcluding with <code>alt=yes</code> (typed as <code><nowiki>{{Alternative/example|alt=yes}}</nowiki></code>, one would recieve:
+
Or, when transcluding with <code>alt=yes</code> (typed as <code><nowiki>{{Alternative/example|alt=yes}}</nowiki></code>, one would receive:
  
 
{{Alternative/example|alt=yes}}
 
{{Alternative/example|alt=yes}}
Line 23: Line 23:
 
=== See also ===
 
=== See also ===
 
*The similar <nowiki>{{barnalt}}</nowiki> template.
 
*The similar <nowiki>{{barnalt}}</nowiki> template.
<includeonly>
+
<includeonly>{{Sandbox other||
 
<!-- CATEGORIES AND INTERWIKIS HERE, THANKS -->
 
<!-- CATEGORIES AND INTERWIKIS HERE, THANKS -->
 
+
[[Category:Typing-aid templates]]
</includeonly>
+
}}</includeonly>

Latest revision as of 12:38, 20 October 2020

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.