Jump to content
Toggle menu
  • 8 articles
  • 75 files
  • 7 users
  • 37.8K edits
Neodyland Wiki
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Template:C/doc: Difference between revisions

Template page
m format
m format
Line 20: Line 20:


|3def=
|3def=
|3stat=optional
|3stat=optional-
|name=C
|name=C
|desc=Links to a category, either within the Commons or to another Wikipedia
|desc=Links to a category, either within the Commons or to another Wikipedia
Line 29: Line 29:
|type=
|type=
|example=
|example=
|i18n-method=-
|i18n-method=
|i18n-desc=
|i18n-desc=The template does not generate any localizable text.
|i18n-mediawiki-msg=
|i18n-mediawiki-msg=
|seealso=
|seealso=
Line 40: Line 40:


== Usage ==
== Usage ==
=== Standard usage ===
Displays a link to a category name.
Parameter 1 is the category name. Parameter 2 may specify any text do be displayed instead.
The template will display <nowiki>{{{2}}}</nowiki>, or just the category name given as <nowiki>{{{1}}}</nowiki>.
The template will display <nowiki>{{{2}}}</nowiki>, or just the category name given as <nowiki>{{{1}}}</nowiki>.
The standard usage is without any prefix and without a namespace. No test occurs, redlinks can result.


The text string in parameter 2 is always displayed as-it-is, with namespace if any is specified.
The text string in parameter 2 is always displayed as-it-is, with namespace if any is specified.


=== Extended usage ===
The function is different for internal access within the commons, and for interwiki access.
The function is different for internal access within the commons, and for interwiki access.


=== Addressing categories within the commons ===  
==== Within the commons ====  
The standard inclusion is without any prefix and without a namespace. No test occurs, redlinks can result.
The template can generate 5 different displays, one for an existing and four for a not-existing category.
 


When parameter 3 is either X or x,  
When parameter 3 is either X or x,  
or when a namespace is encountered, a check for existence is performed.<br>  
or when a namespace is encountered, a check for existence is performed.<br>
When the category exists either with or without namespace the following is the existing category.  
This can avoid the generation of a redlink to a not-existing category.
When later the category is defined, the display occurs like standard as above.
 
When the category exists either with or without namespace the following explanation depends the existing category.  


When the category exists, code is implemented as:
When the category exists, code is implemented as:
Line 76: Line 85:




*<tt><nowiki>{{C|Not-existing-cat}}</nowiki></tt> produces {{C|Not-existing-cat}}
<tt><nowiki>{{C|Not-existing-cat}}</nowiki></tt> produces {{C|Not-existing-cat}}<br><!--
*<tt><nowiki>{{C|Not-existing-cat|display}}</nowiki></tt> produces {{C|Not-existing-cat|display}}
--><tt><nowiki>{{C|Not-existing-cat|display}}</nowiki></tt> produces {{C|Not-existing-cat|display}}
*<tt><nowiki>{{C|Not-existing-cat|3=x}}</nowiki></tt> produces {{C|Not-existing-cat|3=x}}
#  <tt><nowiki>{{C|Category:Not-existing-cat}}</nowiki></tt> produces {{C|Category:Not-existing-cat}}<br><!--
*<tt><nowiki>{{C|Not-existing-cat|display-cat|x}}</nowiki></tt> produces {{C|Not-existing-cat|display-cat|x}}
--><tt><nowiki>{{C|Category:Not-existing-cat|display}}</nowiki></tt> produces {{C|Category:Not-existing-cat|display}}
*<tt><nowiki>{{C|Not-existing-cat|3=X}}</nowiki></tt> produces {{C|Not-existing-cat|3=X}}
<tt><nowiki>{{C|Not-existing-cat|3=x}}</nowiki></tt> produces {{C|Not-existing-cat|3=x}}<br><!--
*<tt><nowiki>{{C|Not-existing-cat|displayname|X}}</nowiki></tt> produces {{C|Not-existing-cat|displayname|X}}
--><tt><nowiki>{{C|Not-existing-cat|display-cat|x}}</nowiki></tt> produces {{C|Not-existing-cat|display-cat|x}}
::Not-existing category with elements (difficult to find an example, try one of [[Special:WantedCategories]])
<tt><nowiki>{{C|Not-existing-cat|3=X}}</nowiki></tt> produces {{C|Not-existing-cat|3=X}}<br><!--
*<tt><nowiki>{{C|Redes||X}}</nowiki></tt> produces {{C|Redes||X}}
--><tt><nowiki>{{C|Not-existing-cat|displayname|X}}</nowiki></tt> produces {{C|Not-existing-cat|displayname|X}}
*<tt><nowiki>{{C|redes|Red_Link|x}}</nowiki></tt> produces {{C|redes|Red_Link|x}}
 
:Not-existing category containing elements (difficult to find an example, try one of [[Special:WantedCategories]])
::<tt><nowiki>{{C|Redes||X}}</nowiki></tt> produces {{C|Redes||X}}
::<tt><nowiki>{{C|redes|Red_Link|x}}</nowiki></tt> produces {{C|redes|Red_Link|x}}




Line 91: Line 103:
*<tt><nowiki>{{C|Category:Commons:Multimedia Features/Media Viewer}}</nowiki></tt> produces {{C|Category:Commons:Multimedia Features/Media Viewer}}
*<tt><nowiki>{{C|Category:Commons:Multimedia Features/Media Viewer}}</nowiki></tt> produces {{C|Category:Commons:Multimedia Features/Media Viewer}}


=== Interwiki access ===
==== Interwiki access ====
It is not possible to check for existence in other Wikipedias.<br>The link is always established, whether the category exists or not.  
It is not possible to check for existence in other Wikipedias.<br>The link is always established, whether the category exists or not.  



Revision as of 08:53, 25 February 2015

Links to a category, either within the Commons or to another Wikipedia

Usage

{{C |1= |2= }}

Template parameters

ParameterDescriptionDefaultStatus
1category name, with or without a namespaceemptyrequired
2link text to display (instead of category name)param. #1optional
3The 3rd parameter establishes either
  • interwiki access, with any language code,
or
  • a link to a category on Commons, always with check for existence
    • existing categories are linked and displayed
    • non-existing categories are not linked, but displayed
(not specified): text is displayed in black color
if 3=x (lower case): text is displayed in red color
if 3=X (upper case): display with red background
emptyoptional

Additional information

The template is intended to be used in the following namespaces: all namespaces

The template is intended to be used by the following user groups: all users == Localization ==

The template does not generate any localizable text.

Usage

Standard usage

Displays a link to a category name. Parameter 1 is the category name. Parameter 2 may specify any text do be displayed instead.

The template will display {{{2}}}, or just the category name given as {{{1}}}.

The standard usage is without any prefix and without a namespace. No test occurs, redlinks can result.

The text string in parameter 2 is always displayed as-it-is, with namespace if any is specified.

Extended usage

The function is different for internal access within the commons, and for interwiki access.

Within the commons

The template can generate 5 different displays, one for an existing and four for a not-existing category.

When parameter 3 is either X or x, or when a namespace is encountered, a check for existence is performed.
This can avoid the generation of a redlink to a not-existing category. When later the category is defined, the display occurs like standard as above.

When the category exists either with or without namespace the following explanation depends the existing category.

When the category exists, code is implemented as:

[[:Category:{{{1}}}|{{{2|{{{1}}}}}}]]

When the category does not exist but has elements assigned, a "red link" will be generated:

[[:Category:{{{1}}}|{{{2|{{{1}}}}}}]]

Otherwise if the category {{{1}}} does not exist no link will be generated;

[[Category:{{{1}}}]] or [[Category:{{{2}}}]] is displayed
[[Category:{{{1}}}]] or [[Category:{{{2}}}]] is displayed when {{{3}}} = x
{{{1}}} or {{{2}}} will get background color when {{{3}}} = X


example
  • {{C}} produces [[:Category:|]]
  • {{C||error}} produces [[:Category:|error]]



  1. {{C|Not-existing-cat}} produces Not-existing-cat
    {{C|Not-existing-cat|display}} produces display
  2. {{C|Category:Not-existing-cat}} produces Category:Not-existing-cat
    {{C|Category:Not-existing-cat|display}} produces display
  3. {{C|Not-existing-cat|3=x}} produces [[Category:Not-existing-cat]]
    {{C|Not-existing-cat|display-cat|x}} produces [[Category:display-cat]]
  4. {{C|Not-existing-cat|3=X}} produces Not-existing-cat
    {{C|Not-existing-cat|displayname|X}} produces displayname
Not-existing category containing elements (difficult to find an example, try one of Special:WantedCategories)
{{C|Redes||X}} produces Redes
{{C|redes|Red_Link|x}} produces [[Category:Red_Link]]


Single and double namespace prefix:

Interwiki access

It is not possible to check for existence in other Wikipedias.
The link is always established, whether the category exists or not.


Cookies help us deliver our services. By using our services, you agree to our use of cookies.