Template:Header: Difference between revisions

From PZwiki
(changes from User:Vibrance (with minor adjustments to border))
(added Template:Language code category to add pages to the category based on their language code)
 
(19 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<noinclude>
<noinclude>
{{Languages}}
{{Protection}}
{{Documentation}}
{{Documentation/sandbox|doc =
[[Category:Templates]]
This template is used to add a [[Wikipedia:Breadcrumb navigation|breadcrumb]], to assist the reader in navigating around the wiki.
</noinclude><includeonly>{| class="tp-header" cellspacing=0 cellpadding=0 style="width: 100%; background: #{{Infobox nc|{{#switch:{{{1|{{ROOTPAGENAME}}}}}|Community|PZwiki|Modding|The Indie Stone=Community|#default=default}}}};"
<span class="toclimit-3">__TOC__</span>
|- valign="center"
==Usage==
! width=1px style="white-space: nowrap; padding: 0 10px; color: #ffffff;" | <!--placeholder icon-->[[File:Moodle Icon Windchill.png|26px|link=Category:Main{{#ifeq:{{Language code}}|true|{{Subpage}}|}}|Top category tree]] [[:Category:Main{{#ifeq:{{Language code}}|true|{{Subpage}}|}}|<span style="color: #{{Header/linkcolor|{{{1}}}}};">{{Translation|Navigation}}:</span>]]
This template should be placed at the top of a page, beneath the level 1 heading (page name). As a page can have several categories, it's best to use the 'best fit' or most logical for the article in question.
| style="padding: 0 10px; color: #ffffff;" |
<pre>
<div style="float: left;">
{{Header|First-level category|Second-level category|Third-level category|etc.}}
{{#if:{{{1|}}}
</pre>
  | [[:Category:{{{1}}}{{#ifeq:{{Language code}}|true|{{Subpage}}|}}|<span style="color: #{{Header/linkcolor|{{{1}}}}};">{{Check title|{{{1}}}|Category|{{Subpage|slash=false}}|true={{{1}}}}}</span>]] >&nbsp;
 
}}{{#if:{{{2|}}}
===Parameters===
  | [[:Category:{{{2}}}{{#ifeq:{{Language code}}|true|{{Subpage}}|}}|<span style="color: #{{Header/linkcolor|{{{1}}}}};">{{Check title|{{{2}}}|Category|{{Subpage|slash=false}}|true={{{2}}}}}</span>]] >&nbsp;
;<code>1</code> - <code>6</code>
}}{{#if:{{{3|}}}
:The name of each category leading up to the page, omitting <code>Category:</code>. The page will be added to the last category in the list, or the {{ll|:Category:Main|top-level category}} of the wiki if all parameters are empty.
  | [[:Category:{{{3}}}{{#ifeq:{{Language code}}|true|{{Subpage}}|}}|<span style="color: #{{Header/linkcolor|{{{1}}}}};">{{Check title|{{{3}}}|Category|{{Subpage|slash=false}}|true={{{3}}}}}</span>]] >&nbsp;
;<code>hidecat</code>
}}{{#if:{{{4|}}}
:If not empty the template will not add the page to the categories defined in <code>1</code> to <code>6</code>.
  | [[:Category:{{{4}}}{{#ifeq:{{Language code}}|true|{{Subpage}}|}}|<span style="color: #{{Header/linkcolor|{{{1}}}}};">{{Check title|{{{4}}}|Category|{{Subpage|slash=false}}|true={{{4}}}}}</span>]] >&nbsp;
 
}}{{#if:{{{5|}}}
===Background color===
  | [[:Category:{{{5}}}{{#ifeq:{{Language code}}|true|{{Subpage}}|}}|<span style="color: #{{Header/linkcolor|{{{1}}}}};">{{Check title|{{{5}}}|Category|{{Subpage|slash=false}}|true={{{5}}}}}</span>]] >&nbsp;
The background color will be set automatically based on the category in the first level (<code>1</code>).
}}{{#if:{{{6|}}}
 
  | [[:Category:{{{6}}}{{#ifeq:{{Language code}}|true|{{Subpage}}|}}|<span style="color: #{{Header/linkcolor|{{{1}}}}};">{{Check title|{{{6}}}|Category|{{Subpage|slash=false}}|true={{{6}}}}}</span>]] >&nbsp;
====Red (default)====
}}'''{{Check title|{{FULLPAGENAME}}|true={{CATBASEPAGENAME}}}}'''
<div style="width:32px; height:32px; background-color:var(--color-red); border:var(--border-red); border-radius:var(--border-radius)"> </div>
</div>
 
<div style="white-space: nowrap; float: right;">
====Blue (community)====
{{#if:{{{hidever|}}}
<div style="width:32px; height:32px; background-color:var(--color-blue); border:var(--border-blue); border-radius:var(--border-radius)"> </div>
  || [[Version history{{#ifeq:{{Language code}}|true|{{#ifexist:Version history{{Subpage}}|{{Subpage}}|}}|}}|<span style="color: #{{Header/linkcolor|{{{1}}}}};">'''{{Translation|Page updated}}:'''</span>]] {{#if:{{{version|}}}
The following categories will result in the blue color scheme.
    | [[:Category:{{{version}}}{{#ifeq:{{Language code}}|true|{{Subpage}}|}}|<span style="color: #{{Header/linkcolor|{{{1}}}}};">{{{version}}}{{#if:{{{incver|}}}|.{{{incver}}}}}</span>]]
*{{ll|:Category:PZwiki|PZwiki}}
    | [[:Category:Unknown Version{{#ifeq:{{Language code}}|true|{{Subpage}}|}}|<span style="color: #{{Header/linkcolor|{{{1}}}}};">{{Check title|Unknown Version|Category|{{Subpage|slash=false|true={{Translate|Unknown Version}}}}}}</span>]]
*{{ll|:Category:Modding|Modding}}
  }}
*{{ll|:Category:The Indie Stone|The Indie Stone}}
 
===DISPLAYTITLE magic word===
The name of a page (known as the display title) can be customized using the {{tll|DISPLAYTITLE}} magic word. This template will automatically display the name of a category/page with a custom display title.
 
==Examples==
Template with {{ll|:Category:Project Zomboid|<code>Project Zomboid</code>}} at the first level, resulting in a red theme.
<pre>{{Header|Project Zomboid|Items|Weapons}}</pre>
;Result:
{{Header|Project Zomboid|Items|Weapons|hidecat=true}}
 
 
Template with {{ll|:Category:PZwiki|<code>PZwiki</code>}} at the first level, resulting in a blue theme.
<pre>{{Header|PZwiki|Site maintenance}}</pre>
;Result:
{{Header|PZwiki|Site maintenance|hidecat=true}}
 
{{Translation guide|<syntaxhighlight lang="html">
{{#switch: {{{1|}}}
| navigation = Navigation
| #default = [[Category:Incorrect template usage]]
}}
}}
</div>
</syntaxhighlight>}}
|}
 
{{#if:{{{hidebody|}}}
==See also==
   | <!-- table end -->
*{{ll|Template:Page version}}
  | <div style="background: #{{#switch:{{{1|{{ROOTPAGENAME}}}}}|Community|PZwiki|Modding|The Indie Stone={{Infobox nc|Community|Body}}|#default={{Infobox nc|default|Body}}}}; border: 1px solid #000000; border-top: 0px; padding: 10px;">}}<!-- missing end tag
}}
</div>
{{ll|Category:Templates}}
-->{{#if:{{{hidecat|}}}|
</noinclude><includeonly><div class="header theme-{{#switch:{{{1|{{ROOTPAGENAME}}}}}|PZwiki|Community|Modding|The Indie Stone=blue|#default=red}}">
   | {{#if:{{{hidever|}}}|
   <div>{{ll|:Category:Main|{{tt|name=Header|default=Navigation|arg1=navigation}}}}:</div>
    | [[Category:{{{version|Unknown Version}}}{{#ifeq:{{Language code}}|true|{{Subpage}}|}}]]
  <div><!--
   }}{{#ifeq:{{FULLROOTPAGENAME}}|Category:Main
  -->{{#if: {{{1|}}}|{{ll|:Category:{{{1}}}|{{#if:{{lcs}}|{{#getdisplaytitle: Category:{{{1}}}{{lcs}} }}|{{{1}}}}}
  | <!-- if current page equals `Category:Main(/xx)`, don't add category -->
  }} >&nbsp;}}{{#if: {{{2|}}}|{{ll|:Category:{{{2}}}|{{#if:{{lcs}}|{{#getdisplaytitle: Category:{{{2}}}{{lcs}} }}|{{{2}}}}}
  | [[Category:{{#if:{{{6|}}}|{{{6}}}
  }} >&nbsp;}}{{#if: {{{3|}}}|{{ll|:Category:{{{3}}}|{{#if:{{lcs}}|{{#getdisplaytitle: Category:{{{3}}}{{lcs}} }}|{{{3}}}}}
    | {{#if:{{{5|}}}|{{{5}}}
  }} >&nbsp;}}{{#if: {{{4|}}}|{{ll|:Category:{{{4}}}|{{#if:{{lcs}}|{{#getdisplaytitle: Category:{{{4}}}{{lcs}} }}|{{{4}}}}}
    | {{#if:{{{4|}}}|{{{4}}}
  }} >&nbsp;}}{{#if: {{{5|}}}|{{ll|:Category:{{{5}}}|{{#if:{{lcs}}|{{#getdisplaytitle: Category:{{{5}}}{{lcs}} }}|{{{5}}}}}
    | {{#if:{{{3|}}}|{{{3}}}
   }} >&nbsp;}}{{#if: {{{6|}}}|{{ll|:Category:{{{6}}}|{{#if:{{lcs}}|{{#getdisplaytitle: Category:{{{6}}}{{lcs}} }}|{{{6}}}}}
    | {{#if:{{{2|}}}|{{{2}}}
  }} >&nbsp;}}'''{{#if:{{lcs}}|{{#getdisplaytitle: {{FULLPAGENAME}} }}|{{PAGENAME}}}}'''<!--
    | {{#if:{{{1|}}}|{{{1}}}
   --></div>
    | Main}} }} }} }} }} }}{{#ifeq:{{Language code}}|true|{{Subpage}}|}}]]
{{#if: {{{hidecat|}}}|
   }}
| {{#ifeq: {{FULLROOTPAGENAME}}|Category:Main
}}<!--
| <!-- if current page equals `Category:Main(/xx)`, don't add category -->
--></includeonly>
| {{ll|Category:<!--
  -->{{#if:{{{6|}}}|{{{6}}}
  |{{#if:{{{5|}}}|{{{5}}}
  |{{#if:{{{4|}}}|{{{4}}}
  |{{#if:{{{3|}}}|{{{3}}}
  |{{#if:{{{2|}}}|{{{2}}}
  |{{#if:{{{1|}}}|{{{1}}}
  |Main}} }} }} }} }} }}}}
   }}{{Language code category}} <!-- if hidecat is blank, add page to language code category -->
}}</div></includeonly>

Latest revision as of 10:37, 9 March 2024

Lock-locked.png
This page has been put into protection by a PZwiki administrator.
Only users in the sysop user group may edit this page.
Notebook.pngTemplate Documentation

This template is used to add a breadcrumb, to assist the reader in navigating around the wiki.

Usage

This template should be placed at the top of a page, beneath the level 1 heading (page name). As a page can have several categories, it's best to use the 'best fit' or most logical for the article in question.

{{Header|First-level category|Second-level category|Third-level category|etc.}}

Parameters

1 - 6
The name of each category leading up to the page, omitting Category:. The page will be added to the last category in the list, or the top-level category of the wiki if all parameters are empty.
hidecat
If not empty the template will not add the page to the categories defined in 1 to 6.

Background color

The background color will be set automatically based on the category in the first level (1).

Red (default)

Blue (community)

The following categories will result in the blue color scheme.

DISPLAYTITLE magic word

The name of a page (known as the display title) can be customized using the {{DISPLAYTITLE}} magic word. This template will automatically display the name of a category/page with a custom display title.

Examples

Template with Project Zomboid at the first level, resulting in a red theme.

{{Header|Project Zomboid|Items|Weapons}}
Result


Template with PZwiki at the first level, resulting in a blue theme.

{{Header|PZwiki|Site maintenance}}
Result

How to translate

This template is translatable.

Template code

Paste the following code into the <includeonly> tag of the translated template and translate the text after each = sign (except for #default =).

{{#switch: {{{1|}}}
| navigation = Navigation
| #default = [[Category:Incorrect template usage]]
}}

Template documentation

Copy the code wrapped in the <noinclude> tag in this template and translate the text after doc = in the {{Documentation}} template.

{{Translation guide}} template should be removed from the translated documentation.

See also

Editors can experiment in this template's sandbox.