83,675
edits
Hoof Hearted (talk | contribs) m (Text replacement - "IfExample" to "If example") |
Hoof Hearted (talk | contribs) (Fixes) |
||
Line 19: | Line 19: | ||
Shows different values when entered.<br> | Shows different values when entered.<br> | ||
;Code: | ;Code: | ||
<pre>{{ #if: {{{value|}}} | what to show if activated | what to show if not }}</pre> | <pre>{{#if: {{{value|}}} | what to show if activated | what to show if not }}</pre> | ||
;Example: | ;Example: | ||
<pre>{{ #if: {{{1|}}} | The name of this site is {{{1}}}. | This site has an unknown name. }}</pre> | <pre>{{#if: {{{1|}}} | The name of this site is {{{1}}}. | This site has an unknown name. }}</pre> | ||
Let's say this is included in the template ''[[Template:If example| | Let's say this is included in the template ''[[Template:If example|if example]]''. If <code><nowiki>{{if example|WikiIndex}}</nowiki></code> is entered, '{{if example|WikiIndex}}' will show up because value was specified, as 'WikiIndex'. <code><nowiki>{{if example|not WikiIndex}}</nowiki></code> makes '{{if example|not WikiIndex}}', because value is specified, as 'not WikiIndex'. <code><nowiki>{{if example}}</nowiki></code> makes just '{{if example}}' because it was left blank. | ||
==ifeq== | ==ifeq== | ||
Line 39: | Line 39: | ||
Compares values.<br> | Compares values.<br> | ||
;Code: | ;Code: | ||
<pre>{{ #switch: value | <pre>{{#switch:value | ||
| value1 = what to show if value1 is entered | |value1 = what to show if value1 is entered | ||
| value2 = what to show if value2 is entered | |value2 = what to show if value2 is entered | ||
| | what to show if something else is entered | | |what to show if something else is entered | ||
| #default = what to show if nothing is entered | |#default = what to show if nothing is entered | ||
}}</pre> | }}</pre> | ||
;Example: | ;Example: | ||
<pre>{{ #switch: {{{1}}} | <pre>{{#switch:{{{1}}} | ||
| a = argh | |a = argh | ||
| b = blah | |b = blah | ||
| c = cough | |c = cough | ||
| | anything | | |anything | ||
| #default = nothing | |#default = nothing | ||
}}</pre> | }}</pre> | ||
This is included in the template [[ | This is included in the template [[Template:switchExample|switchExample]]. <code><nowiki>{{switchExample|a}}</nowiki></code> gives '{{switchExample|a}}' because a is entered. <code><nowiki>{{switchExample}}</nowiki></code> gives '{{switchExample}}', because the template was left blank. <code><nowiki>{{switchExample|d}}</nowiki></code> gives '{{switchExample|d}}', because d doesn't exist in the template. | ||
==time== | ==time== |
edits