Template:CatInclude

From Joomla! Documentation
(Difference between revisions)
Jump to: navigation, search
m (Protected "Template:CatInclude": High traffic page: This template could impact a high volume of pages (‎[edit=sysop] (indefinite) ‎[move=sysop] (indefinite)))
m (tweaks to allow template category inclusion in JDOC namespace as it may be necessary in some cases)
Line 1: Line 1:
{{#switch: {{NAMESPACE}}
+
{{#if:{{{jdoc|}}}|{{#switch: {{NAMESPACE}}
 +
|Template=<!-- no categorization -->
 +
|#default={{#arraydefine:cats|{{{1|}}}}} {{#arrayprint:cats||@@@@|[[Category:@@@@|{{PAGENAME}}]]}}{{#arrayreset:cats}}
 +
}}
 +
|{{#switch: {{NAMESPACE}}
 
|Template=<!-- no categorization -->
 
|Template=<!-- no categorization -->
 
|JDOC=<!-- no categorization -->
 
|JDOC=<!-- no categorization -->
 
|#default={{#arraydefine:cats|{{{1|}}}}} {{#arrayprint:cats||@@@@|[[Category:@@@@|{{PAGENAME}}]]}}{{#arrayreset:cats}}
 
|#default={{#arraydefine:cats|{{{1|}}}}} {{#arrayprint:cats||@@@@|[[Category:@@@@|{{PAGENAME}}]]}}{{#arrayreset:cats}}
}}<noinclude>The {{tl|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 JDOC NAMESPACES. The code being used is shown below.  
+
}}}}<noinclude>The {{tl|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 JDOC NAMESPACES. The code being used is shown below.  
 
<pre>
 
<pre>
 
{{#switch: {{NAMESPACE}}
 
{{#switch: {{NAMESPACE}}

Revision as of 12:39, 2 December 2012

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 JDOC NAMESPACES. The code being used is shown below.

{{#switch: {{NAMESPACE}}
|Template=<!-- no categorization -->
|JDOC=<!-- no categorization -->
|#default={{#arraydefine:cats|{{{1|}}}}} {{#arrayprint:cats||@@@@|[[Category:@@@@|{{PAGENAME}}]]}}{{#arrayreset:cats}}
}}

Contents

[view] [edit] [history]

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.

Usage

Must use the parameter {{{1|}}}

  • A simple call would be to add {{CatInclude|Development,Tutorial,Plugin}} 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|Development,Tutorial,Plugin}}|[[Category:Foo]]}}
OR
{{#ifeq:{{{foo|}}}|tutorial|{{CatInclude|Development,Tutorial,Plugin}}|{{CatInclude|Development}}}}

Parameters

Parameter Parameter description req./opt.
{{{1}}} categories (in array format, comma separated)
For Example: Development,Tutorial,Plugin
required

Known Issues

None known, please report on this Template's talk page.


Personal tools
Namespaces

Variants
Actions
Navigation
Joomla! Sites
Toolbox