ModEnc is currently in Maintenance Mode: Changes could occur at any given moment, without advance warning.

Template:Categ: Difference between revisions

From ModEnc
Jump to navigation Jump to search
m added "dont use outside $conditions" note
Vinifera7 (talk | contribs)
Just cleaning up a bit..
Line 1: Line 1:
<includeonly>{{#ifexist:Category:{{{1}}} Flags|[[:Category:{{{1}}} Flags|{{{2|{{{1}}}}}}]] [[Category:{{{1}}} Flags]]|{{#ifexist:Category:{{#sub:{{{1}}}|0|-1}} Flags|[[:Category:{{#sub:{{{1}}}|0|-1}} Flags|{{{2|{{{1}}}}}}]] [[Category:{{#sub:{{{1}}}|0|-1}} Flags]]|[[:Category:{{{1}}} Flags|{{{2|{{{1}}}}}}]] [[Category:{{{1}}} Flags]]}}}}</includeonly> <noinclude>This template turns the text into a category link and adds the page to that category. Intented to be used inside Flag template to autolink the page to certain subsets of [[:Category:INI_Flags]]. Usage:<pre>{{Categ|Example}}</pre> will create a link to <tt>Category:Example_Flags</tt> titled <tt>Example</tt> and add the page to that category. <pre>{{Categ|Example|SmartName}}</pre> will create a link to <tt>Category:Example_Flags</tt> titled <tt>SmartName</tt> and add the page to that category. <br>'''Note''': certain categories are named slightly differently than the rest - e.g., categ|Warheads and Category:Warhead_Flags (not Warheads_Flags like categ|InfantryTypes and Category:InfantryTypes_Flags is). Now the template will silently drop the last letter of the category name if that yields an existing category and not doing so wouldn't. In short, previously you would have needed Categ|Warhead|Warheads to make it work properly, now it does so automagically.<br>'''Note #2''': this template is intended to be used in the Flag Template, Applicable To field. Do not use it elsewhere unless you know what you're doing.</noinclude>
<includeonly>{{#ifexist:Category:{{{1}}}_Flags|[[{{{1}}}|{{{2|{{{1}}}}}}]][[Category:{{{1}}}_Flags]]|{{#ifexist:Category:{{#sub:{{{1}}}|0|-1}}_Flags|[[{{#sub:{{{1}}}|0|-1}}|{{{2|{{{1}}}}}}]][[Category:{{#sub:{{{1}}}|0|-1}}_Flags]]|[[{{{1}}}_Flags|{{{2|{{{1}}}}}}]][[Category:{{{1}}}_Flags]]}}}}</includeonly><noinclude>
This template creates a link and adds the page to the appropriate subcategory of [[:Category:INI_Flags]].
 
==Usage==
This is intented to be used with [[Template:Flag]] to link to certain pages, while adding the flags categories as well. It is not meant to be used as a shortcut for writing out a link to a category page.
 
Certain titles of subcategories of [[:Category:INI_Flags]] exclude the terminating "s" that is present in the corresponding article's page. For example, the title of [[Warheads]] contains a terminating "s", while [[:Category:Warhead_Flags]] does not. Although <code>{{Categ|Warhead|Warheads}}</code> would function correctly, this template automatically accounts for the terminating "s" if <code>{{Categ|Warheads}}</code> were used instead.{{fnl|1}}
 
===Examples===
<pre>{{Categ|InfantryTypes}}</pre>
This code yields [[InfantryTypes]] and includes the page in [[:Category:InfantryTypes_Flags]].
 
<pre>{{Categ|InfantryTypes|infantry}}</pre>
This code yields [[InfantryTypes|infantry]] and includes the page in [[:Category:InfantryTypes_Flags]].
 
==Notes==
{{fn|1|This template is automagically delicious.}}
</noinclude>

Revision as of 01:51, 23 May 2008

This template creates a link and adds the page to the appropriate subcategory of Category:INI_Flags.

Usage

This is intented to be used with Template:Flag to link to certain pages, while adding the flags categories as well. It is not meant to be used as a shortcut for writing out a link to a category page.

Certain titles of subcategories of Category:INI_Flags exclude the terminating "s" that is present in the corresponding article's page. For example, the title of Warheads contains a terminating "s", while Category:Warhead_Flags does not. Although Warheads would function correctly, this template automatically accounts for the terminating "s" if Warheads were used instead.1

Examples

{{Categ|InfantryTypes}}

This code yields InfantryTypes and includes the page in Category:InfantryTypes_Flags.

{{Categ|InfantryTypes|infantry}}

This code yields infantry and includes the page in Category:InfantryTypes_Flags.

Notes

1 This template is automagically delicious.