CatInclude
From ISOGG Wiki
The {{CatInclude}} template makes category inclusion in other templates easier. It eliminates the need for complicated #switches and #ifeq of NAMESPACE to allow category inclusion in templates without including those categories in certain NAMESPACES such as, the Template and ISOGG Wiki NAMESPACES. The code being used is shown below.
{{#switch: {{NAMESPACE}} |Template=<!-- no categorization --> |ISOGG Wiki=<!-- no categorization --> |#default={{#arraydefine:cats|{{{1|}}}}} {{#arrayprint:cats||@@@@|[[Category:@@@@|{{PAGENAME}}]]}}{{#arrayreset:cats}} }}
[edit] [ ] Template documentation
The template makes category inclusion in other templates easier. It eliminates the need for complicated #switches and #ifeq of NAMESPACE to allow category inclusion in templates without including those categories in certain NAMESPACES such as, the Template and JDOC NAMESPACES.
Functions/Features
Automatic category inclusion in templates.
Warning: | It is possible to use this template directly in articles. Until this warning is removed, it is not recommended. |
Usage
Must use the parameter {{{1|}}}
- A simple call would be to add {{CatInclude|Navigation page,Portal page,Landing page}} to pages which use a template to add content to a wiki page.
- A complex template call against a parameter in a template can be used inside a #if, #ifeq or #switch call.
- Example
- {{#ifeq:{{{foo|}}}|tutorial|{{CatInclude|Navigation page,Portal page,Landing page}}|[[Category:Foo]]}}
- OR
- {{#ifeq:{{{foo|}}}|tutorial|{{CatInclude|Navigation page,Portal page,Landing page}}|{{CatInclude|Landing page}}}}
Parameters
Parameter | Parameter description | req./opt. |
---|---|---|
{{{1}}} | categories (in array format, comma separated) For Example: Navigation page,Portal page,Landing page |
required |
Known Issues
None known, please report on this Template's talk page.
The above documentation is transcluded from Template:CatInclude/doc. (edit | history) Editors can experiment in this template's sandbox (create) and testcases (create) pages. Please add categories and interwikis to the /doc subpage. Subpages of this template. |