Toggle menu
24.1K
670
183
158.6K
HausaDictionary.com | Hausa English Translations
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Template:Parameter count: Difference between revisions

Template page
*>Razorflame
m Protected "Template:Parameter count": Highly visible template; used by over 1,700 pages; protecting to prevent tampering ([edit=autoconfirmed] (indefinite) [move=autoconfirmed] (indefinite))
*>Coppertwig
Now counts up to six.
Line 6: Line 6:
Example usage:
Example usage:
<pre>
<pre>
{{#switch:{{Parameter count | {{{1| }}} | {{{2| }}} | {{{3| }}} | {{{4| }}} | {{{5| }}} }}
{{#switch:{{Parameter count | {{{1| }}} | {{{2| }}} | {{{3| }}} | {{{4| }}} | {{{5| }}} {{{6| }}}}}
       |zero=text to be displayed for zero parameters
       |zero=text to be displayed for zero parameters
       |one=text to be displayed for one parameter
       |one=text to be displayed for one parameter
Line 13: Line 13:
       |four=text to be displayed for four paramters
       |four=text to be displayed for four paramters
       |five=text to be displayed for five parameters
       |five=text to be displayed for five parameters
       |This text is never displayed; it only counts up to five.}}
      |six=text to be displayed for six parameters
       |This text is never displayed; it only counts up to six.}}
</pre>
</pre>
</noinclude>
</noinclude>
Line 21: Line 22:
     {{#ifeq: {{{3| }}} | | two |
     {{#ifeq: {{{3| }}} | | two |
         {{#ifeq: {{{4| }}} | | three |
         {{#ifeq: {{{4| }}} | | three |
           {{#ifeq: {{{5| }}} | | four | five
           {{#ifeq: {{{5| }}} | | four |
            {{#ifeq: {{{6| }}} | | five | six
            }}
           }}
           }}
         }}
         }}

Revision as of 14:56, 15 February 2009

Template to find number of parameters. For example, if the template is called with three parameters, like this: {{Parameter count|x|y|z}} then it shows "three". If there are no parameters, it shows "zero". If there are five or more, it shows "five". It only counts up to the first nonblank parameter, and ignores it and all parameters after it.

This template is used by the verb template.

Example usage:

{{#switch:{{Parameter count | {{{1| }}} | {{{2| }}} | {{{3| }}} | {{{4| }}} | {{{5| }}} {{{6| }}}}}
       |zero=text to be displayed for zero parameters
       |one=text to be displayed for one parameter
       |two=text to be displayed for two parameters
       |three=text to be displayed for three parameters
       |four=text to be displayed for four paramters
       |five=text to be displayed for five parameters
       |six=text to be displayed for six parameters
       |This text is never displayed; it only counts up to six.}}