Template:Namespace detect showall/doc

From Zoophilia Wiki
Revision as of 13:10, 21 August 2008 by meta>Davidgothberg (Adding an example, and a list of all parameters, and "technical details".)
Jump to navigationJump to search

This is the {{namespace detect showall}} meta-template.

It helps other templates detect what type of page they are on. It is an extended version of {{namespace detect}}.

This template detects and groups all the different namespaces used on Wikipedia into several types:

main = Main/article space, as in normal Wikipedia articles.
talk = Any talk space, such as page names that start with "Talk:", "User talk:", "Image talk:" and so on.
user, wikipedia, image, mediawiki, template, help, category and portal = The other namespaces except the talk pages.
other = Any namespaces that were not specified as a parameter to the template. See explanation below.

Note! For most usage cases it might be better to use the simpler namespace detection templates. (See the see also section below.) Since this template is more prone to human errors such as misspelling the parameter names.

Usage

This template takes one or more parameters named after the different page types as listed above. Like this:

{{namespace detect showall
| 1 = Article text.
| 2 = Talk page text.
| main  = 1
| talk  = 2
| other = showall
}}

If the template is on a main (article) page, it will return this:

Article text.

If the template is on any other page than an article or a talk page it will show all the data that was fed to the numbered parameters, like this:

Article text.Talk page text.


(More documentation coming soon.)


List of all parameters:

{{namespace detect showall
| 1 = Text one.
...
| 6 = Text six.
| main  = 1 / 2 / 3 / 4 / 5 / 6 / showall
...
| other = 1 / 2 / 3 / 4 / 5 / 6 / showall
| demospace = {{{demospace|}}} / showall /
              main / talk / user / wikipedia / image / mediawiki / 
              template / help / category / portal / other
}}

Note: Empty values to the "main" ... "portal" parameters do have special meaning.

Technical details

If you intend to feed tables as content to the numbered parameters of this template, then you need to know this:

Templates do have a problem to handle parameter data that contains pipes "|", unless the pipe is inside another template {{name|param1}} or inside a piped link [[Help:Template|help]]. Thus templates can not handle wikitables as input unless you escape them by using the {{!}} template. This makes it hard to use wikitables as parameters to templates. Instead the usual solution is to use "HTML wikimarkup" for the table code, which is more robust.

For more technical details such as about "copying to other projects" and "CSS based namespace detection" see {{main talk other}} and its talk page.

See also

Easy to use namespace-detection templates:

Technical stuff: