Template:Incorrect namespace/doc: Difference between revisions

Content deleted Content added
m Restoring previous example.
Usage: update
 
(42 intermediate revisions by 21 users not shown)
Line 1:
{{Documentation subpage}}
{{nosubst}}
 
==Usage==
This template is for use in other templates in conjunction with namespace detection. It adds pages to [[:Category:Pages with incorrectly transcluded templates]].
This template is for use in other templates in conjunction with namespace detection. It adds pages to {{Cat|Pages with templates in the wrong namespace}}. The template has been designed to not work in the template namespace so templates transcluding this template can be viewed normally. The template also does not work on sub-pages titled "sandbox" or "testcases" or on [[Wikipedia:Sandbox]].
 
{{tlx|Single namespace}} can be used instead of this template if only one namespace is specified (such as in the example below).
 
===Parameters===
The; unnamed parameter 1
: (required) This parameter inserts text in the message to specify the namespace the template in question should use.
 
; {{parameter|nocat}}
: (optional) when set to a positive value (<code>true</code>, <code>yes</code>, or <code>1</code>), will prevent the inclusion of {{Cat|Pages with templates in the wrong namespace}}. See [[Wikipedia:Category suppression]]
 
===Example===
<syntaxhighlight lang="wikitext">
<code><nowiki>{{Ambox</nowiki><br/>
{{Ombox
| type = style<br/>notice
| text = Example text.<br/>
}}<br/>
<nowiki>}}<includeonly>{{MainHelp other|[[Category:Example category]]|{{Incorrect namespace|mainhelp}}}}</includeonly>
</nowiki></codesyntaxhighlight>
 
produces:
 
{{AmboxOmbox
| type = stylenotice
| text = Example text.
}}
{{AmboxMbox
| type = content
| image = [[File:Ambox warning orange.svg|50px|link=|alt=]]
| text = The above{{Error|This template should only be transcluded in the main''help'' namespace(s).}}
}}
 
In the above example, transcluding{{tl|Help theother}} articleis messageused boxto willadd categorisepages mainin namespacethe pages''help'' intonamespace [[:to ''Category:Example category]]''. andFor producepages outside the ''help'' namespace, '''<nowiki>{{Incorrect namespace|help}}</nowiki>''' is thisused templateto underneathdisplay the error message box forand pagesadd outsidethe page to ''[[:Category:Pages with templates in the mainwrong namespace]]''. To omit the error category, use '''<nowiki>{{Incorrect namespace|help|nocat=true}}</nowiki>'''.
 
==See also==
* {{tl|Single namespace}}
* {{tl|Incorrect redirect template}}
 
<includeonly>{{Sandbox other||
[[Category:Template namespace templates]]
}}</includeonly>