Difference between revisions of "Template:Alternative/doc"
Jump to navigation
Jump to search
blackwiki>Mclay1 m (moved Template:Alternate/doc to Template:Alternative/doc) |
blackwiki>Mclay1 m (alternate → alternative per WP:COMMONALITY) |
||
| Line 3: | Line 3: | ||
This template '''must''' be substituted. | This template '''must''' be substituted. | ||
=== Usage === | === Usage === | ||
| − | This template is used to add an | + | 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>). |
==== Parameters ==== | ==== Parameters ==== | ||
*'''Default''': The information to be displayed when the <code>alt</code> parameter is omitted or set to anything but yes. | *'''Default''': The information to be displayed when the <code>alt</code> parameter is omitted or set to anything but yes. | ||
*'''Alternate''': The information to be used when the <code>alt</code> parameter is set to yes. | *'''Alternate''': The information to be used when the <code>alt</code> parameter is set to yes. | ||
==== Examples ==== | ==== Examples ==== | ||
| − | In order to use this template, it must be substed into another. For this example, that will be [[Template: | + | 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: |
| − | <pre>Bob said "{{subst: | + | <pre>Bob said "{{subst:alternative|default=hello|alternate=goodbye}}."</pre> |
After the page is saved, the page's code would read: | After the page is saved, the page's code would read: | ||
<pre>Bob said "{{#ifeq:{{{alt}}}|yes|goodbye|hello}}."</pre> | <pre>Bob said "{{#ifeq:{{{alt}}}|yes|goodbye|hello}}."</pre> | ||
| − | Then, when transcluding that page without the alt option (typed as <code><nowiki>{{ | + | Then, when transcluding that page without the alt option (typed as <code><nowiki>{{Alternative/example}}</nowiki></code>), the following text would be displayed: |
| − | {{ | + | {{Alternative/example}} |
| − | Or, when transcluding with <code>alt=yes</code> (typed as <code><nowiki>{{ | + | Or, when transcluding with <code>alt=yes</code> (typed as <code><nowiki>{{Alternative/example|alt=yes}}</nowiki></code>, one would recieve: |
| − | {{ | + | {{Alternative/example|alt=yes}} |
=== See also === | === See also === | ||
Revision as of 13:32, 23 December 2010
| 40px | This is a documentation subpage for Template:Alternative. It contains usage information, categories and other content that is not part of the original template page. |
This template must be substituted.
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
altparameter is omitted or set to anything but yes. - Alternate: The information to be used when the
altparameter 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|alternate=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 recieve:
Bob said "goodbye."
See also
- The similar {{barnalt}} template.