Template:Incorrect namespace/doc: Difference between revisions

Content deleted Content added
more efficient substitution template
Usage: update
 
(10 intermediate revisions by 8 users not shown)
Line 11:
: (required) This parameter inserts text in the message to specify the namespace the template in question should use.
 
; {{parameter|nocat}}
: (optional) This parameter, ifwhen set to a positive value other(<code>true</code>, than<code>yes</code>, or <code>false1</code>), will prevent the inclusion of {{Cat|Pages with templates in the wrong namespace}}. See [[Wikipedia:Category suppression]]
 
===Example===
<syntaxhighlight lang="wikitext">
<code><nowiki>{{Ombox</nowiki><br/>
{{Ombox
| type = notice<br/>
| text = Example text.<br/>
}}<nowiki><includeonly>{{Help other|[[Category:Example category]]|</nowiki>'''<nowiki>{{Incorrect namespace|help}}</nowiki>'''<nowiki>}}</includeonly></nowiki></code>
</syntaxhighlight>
 
produces:
 
{{Ombox
| type = notice
| text = Example text.
}}
{{Mbox
{{Ombox|type=content|image = [[File:Ambox warning orange.svg|50px]]|text={{Error|The above template should only be transcluded in the ''help'' namespace(s).}}}}
| type = content
| image = [[File:Ambox warning orange.svg|50px|link=|alt=]]
{{Ombox|type=content|image text = [[File:Ambox warning orange.svg|50px]]|text={{Error|The aboveThis template should only be transcluded in the ''help'' namespace(s).}}}}
}}
 
In the above example, {{tl|Help other}} is used to add pages in the ''help'' namespace to ''Category:Example category''. For pages outside the ''help'' namespace, '''<nowiki>{{Incorrect namespace|help}}</nowiki>''' is used to display the error message box and add the page to ''[[:Category:Pages with templates in the wrong namespace]]''. To omit the error category, use '''<nowiki>{{Incorrect namespace|help|nocat=true}}</nowiki>'''.
Line 31 ⟶ 40:
* {{tl|Incorrect redirect template}}
 
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandboxSandbox other||
[[Category:Pages with templates in the wrong namespace| ]]
[[Category:Template namespace templates]]
 
}}</includeonly>