Template:Namespaced category overriding/doc

From Computing Classics Wiki
Revision as of 06:14, 24 September 2024 by TheDragonFire123 (talk | contribs) (5 revisions imported: All kinds of templates for CCW to emulate AEW's old hard drive stock)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Icon This is a documentation subpage for Template:Namespaced category overriding.

It contains usage information, categories and other content that is not part of the original template page.

This template allows for conditional categorisation, where a page will only be placed into a category if the template is used in a given namespace. It is based on {{Namespaced category}}. In addition, it also adds a conditional override system through its second unnamed parameter. If it is sent -1, categorisation is completely disabled (by setting namespace to -1, an impossible combination). If it is sent 1, it always categorises regardless of namespace (by setting namespace to {{NAMESPACENUMBER}}, so the check succeeds no matter what). If set to any other option, including left blank, it performs the namespace check of its dependent template. It is intended for use by integration into other templates, to allow use in applications where automatic categorisation is not always desired (for example, to illustrate usage, or to use the template with parameters that might break automatic categorisation).

Example usage[edit source]

  • To categorise pages into Category:Buses, only in mainspace, and pass in a parameter named "force_cat" that can be set to -1 to fully disable or 1 to force:
    • {{NsCatO|Buses|{{{force_cat|}}}}}
  • To categorise pages into Category:Western Digital Marvell families, only in the category namespace, and pass in a parameter named "force_cat" that can be set to -1 to fully disable or 1 to force it to regardless of namespace:
    • {{NsCatO|Western Digital Marvell families|{{{force_cat|}}}|namespace = 14}}

TemplateData[edit source]

Checks the namespace of the page, and if it matches mainspace (or the number of the given namespace), adds a category. It also adds an overriding function, where 1 forces categorisation and -1 disables it.

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
Category name1

The name of the category to add if the check succeeds (do not add Category: prefix)

Example
Buses with unknown VIN
Stringrequired
Force category option parameter2

For use inside templates. The parameter that your template uses to specify category forcing.

Example
{{{force_cat|}}}
Numbersuggested
Namespace numbernamespace

The namespace number to display this category in.

Default
0
Example
2
Numberoptional
Cookies help us deliver our services. By using our services, you agree to our use of cookies.