Tractor & Construction Plant Wiki
(created from wikipedia template of same name)
 
m (1 revision: template test)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
 
{{#switch:
 
{{#switch:
 
<!--If no or empty "demospace" parameter then detect namespace-->
 
<!--If no or empty "demospace" parameter then detect namespace-->
{{#if:{{{demospace|}}}
+
{{#if:{{{demospace|}}}
 
| {{lc: {{{demospace}}} }} <!--Use lower case "demospace"-->
 
| {{lc: {{{demospace}}} }} <!--Use lower case "demospace"-->
| {{#ifeq:{{NAMESPACE}}|Template
+
| {{#ifeq:{{NAMESPACE}}|{{ns:Template}}
 
| template
 
| template
 
| other
 
| other
}}
+
}}
 
}}
 
}}
 
| template = {{{1|}}}
 
| template = {{{1|}}}
Line 13: Line 13:
 
}}<!--End switch--><noinclude>
 
}}<!--End switch--><noinclude>
   
  +
{{documentation}}
<!-- {{pp-template|small=yes}} -->
 
{{Documentation}}
 
 
<!-- Add categories and interwikis to the /doc subpage, not here! -->
 
<!-- Add categories and interwikis to the /doc subpage, not here! -->
 
</noinclude>
 
</noinclude>

Latest revision as of 15:09, 30 March 2011


[edit] [purge] Template documentation

This is the {{template other}} meta-template.

It helps other templates detect what type of page they are on.

Basic usage

This template usually takes two parameters, like this:

{{template other | Template page text | Other pages text }}

If the template is on a template page, it will return this:

Template page text

If the template is on any other page, it will return this:

Other pages text

A typical usage case could be to make it so that a template only adds a category when not on a template page. Thus not adding the template itself and other templates that are built with it to the category. Like this:

{{template other | | [[Category:Some maintenance category]] }}

Note that in the example above the "template" parameter was left empty.

Advanced usage

This template works like {{main talk other}}, see full documentation there. Note that it detects "Template talk:" pages as type other. The test parameter demospace for this template understands the values template and other.

See also

Easy to use namespace-detection templates:

  • {{main other}} – For article templates.
  • {{talk other}} – For talk page templates.
  • {{file other}} – For file (image) templates.
  • {{template other}} – For detecting template pages.
  • {{category other}} – For category templates.