Template:Header: Difference between revisions

From PZwiki
m (Include incver)
Tag: Reverted
(added Template:Language code category to add pages to the category based on their language code)
 
(7 intermediate revisions by 2 users not shown)
Line 2: Line 2:
{{Protection}}
{{Protection}}
{{Documentation/sandbox|doc =
{{Documentation/sandbox|doc =
This template is used at the top of pages, listing all the categories leading up to the page it is on. It also contains the version the article was updated to, adding it to a version category for maintenance.
This template is used to add a [[Wikipedia:Breadcrumb navigation|breadcrumb]], to assist the reader in navigating around the wiki.  
 
<span class="toclimit-3">__TOC__</span>
==Usage==
==Usage==
This template must be placed at the top of a page, under the {{tll|Languages}} template, if it is present.
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.  
<pre>
<pre>
{{Header|First-level category|Second-level category|Third-level category|etc.|version=Version 41|incver=78.16}}
{{Header|First-level category|Second-level category|Third-level category|etc.}}
</pre>
</pre>


===Parameters===
===Parameters===
;<code>1</code> - <code>6</code>
;<code>1</code> - <code>6</code>
:The name of each categories leading up to the item/page, omitting <code>Category:</code>. This will add the page to the last category. Will add the page to the {{ll|:Category:Main|top category}} of the wiki if all parameters are empty.
: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.
;<code>version</code>
:The major Project Zomboid version this page's content is up to date to. When updating a page use '''Version (#)'''. The contents of this parameter will also be categorized on the page. Will add the page to {{ll|:Category:Unknown Version|Unknown Version}} if empty.
;<code>incver</code>
:The incremental (minor) PZ version this page's content is up to date to.
;<code>hidebody</code>
:If not empty the template will not display the body (background), only displaying the header.
;<code>hidever</code>
:If not empty the template will not display the version number.
;<code>hidecat</code>
;<code>hidecat</code>
:If not empty the template will not add the page to the categories defined in <code>1</code> to <code>6</code>.
:If not empty the template will not add the page to the categories defined in <code>1</code> to <code>6</code>.


===Background color===
===Background color===
The background color is automatically set based on the category in the first anonymous parameter (<code>1</code>).
The background color will be set automatically based on the category in the first level (<code>1</code>).


There are currently 2 color schemes, known as: <span style="background-color: #{{Infobox nc|default}}; color: #{{Infobox nc|default|Text}}">Zomboid red</span> and <span style="background-color: #{{Infobox nc|Community}}; color: #{{Infobox nc|Community|Text}}">Community blue</span>. These are taken from the {{tll|Infobox nc}} template.
====Red (default)====
<div style="width:32px; height:32px; background-color:var(--color-red); border:var(--border-red); border-radius:var(--border-radius)"> </div>


====Community categories====
====Blue (community)====
<div style="width:32px; height:32px; background-color:var(--color-blue); border:var(--border-blue); border-radius:var(--border-radius)"> </div>
The following categories will result in the blue color scheme.
The following categories will result in the blue color scheme.
*{{ll|:Category:PZwiki|PZwiki}}
*{{ll|:Category:PZwiki|PZwiki}}
Line 35: Line 29:
*{{ll|:Category:The Indie Stone|The Indie Stone}}
*{{ll|:Category:The Indie Stone|The Indie Stone}}


===Translating===
===DISPLAYTITLE magic word===
Many parts of this template are auto-translated using the {{tll|Translation}} template or {{tll|DISPLAYTITLE}} magic word. It is not necessary to translate this template to a language subpage, it is sufficient to just use {{tll|Header}}.
 
====Translation template====
Static elements can be translated in the {{tll|Translation}} template. If they're not already present, include and translate the below. Translations go after the equals (<code>=</code>) sign.
<syntaxhighlight lang="text">
| Navigation =
| Page updated =
| Unknown Version =
</syntaxhighlight>
 
====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.
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.
Ensure you've added the language code subpage.


==Examples==
==Examples==
<pre>{{Header|Modding|hidever=true}}</pre>
Template with {{ll|:Category:Project Zomboid|<code>Project Zomboid</code>}} at the first level, resulting in a red theme.
'''Will produce:'''
<pre>{{Header|Project Zomboid|Items|Weapons}}</pre>
{{Header|Modding|hidever=true|hidecat=true}}
;Result:
A whole page's worth of content in here.</div>
{{Header|Project Zomboid|Items|Weapons|hidecat=true}}


'''And'''
<pre>{{Header|The Game World|Items|Weapons|version=Version 41|incver=78.16}}</pre>
'''Will produce:'''
{{Header|The Game World|Items|Weapons|version=Version 41|incver=78.16|hidecat=true}}
Another page of content in here.</div>


==FAQs==
Template with {{ll|:Category:PZwiki|<code>PZwiki</code>}} at the first level, resulting in a blue theme.
'''Q: How to translate this template?<br>
<pre>{{Header|PZwiki|Site maintenance}}</pre>
'''A:''' To translate the template, don't create a language version, just use the {{Tll|Header}} and not <s><code><nowiki>{{Header/xx}}</nowiki></code></s> and translate the respective words in [[Template:Translation]] for your language.
;Result:
{{Header|PZwiki|Site maintenance|hidecat=true}}


'''Q: Why is there a <nowiki></div></nowiki> missing in the template?<br>
{{Translation guide|<syntaxhighlight lang="html">
'''A:''' This is intentional. It means no matter what is added to the page in the future, it will be included in the template's background. It automatically stops when it reaches the footer anyway. If the background is not reaching the bottom of the page, add the {{Tll|Clear}} template to the bottom of the page.
{{#switch: {{{1|}}}
 
| navigation = Navigation
<s>'''Q: Why do I need to use version and incver when adding the page's version?'''<br>
| #default = [[Category:Incorrect template usage]]
'''A:''' The reason for this is to avoid having several categories for a single release version. For example, without both we would end up with a <code>Category:Version 36</code>, <code>Category:Version 36.1</code>, 36.2, 36.3… You see where this is going.</s><br>
}}
''Updated 23/10/2023. <code>incver</code> now included in version category.
</syntaxhighlight>}}


==See also==
==See also==
*{{ll|Template:Languages}}
*{{ll|Template:Page version}}
}}
}}
{{ll|Category:Templates}}
{{ll|Category:Templates}}
</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}}}};"
</noinclude><includeonly><div class="header theme-{{#switch:{{{1|{{ROOTPAGENAME}}}}}|PZwiki|Community|Modding|The Indie Stone=blue|#default=red}}">
|- valign="center"
  <div>{{ll|:Category:Main|{{tt|name=Header|default=Navigation|arg1=navigation}}}}:</div>
! width=1px style="white-space: nowrap; padding: 0 10px; color: #ffffff;" | <!--placeholder icon-->[[File:Moodle Icon Windchill.png|26px|link=Category:Main{{lcs}}|Top category tree]] [[:Category:Main{{lcs}}|<span style="color: #{{Header/linkcolor|{{{1}}}}};">{{Translation|Navigation}}:</span>]]
  <div><!--
| style="padding: 0 10px; color: #ffffff;" |
  -->{{#if: {{{1|}}}|{{ll|:Category:{{{1}}}|{{#if:{{lcs}}|{{#getdisplaytitle: Category:{{{1}}}{{lcs}} }}|{{{1}}}}}
<div style="float: left;">
  }} >&nbsp;}}{{#if: {{{2|}}}|{{ll|:Category:{{{2}}}|{{#if:{{lcs}}|{{#getdisplaytitle: Category:{{{2}}}{{lcs}} }}|{{{2}}}}}
{{#if:{{{1|}}}
  }} >&nbsp;}}{{#if: {{{3|}}}|{{ll|:Category:{{{3}}}|{{#if:{{lcs}}|{{#getdisplaytitle: Category:{{{3}}}{{lcs}} }}|{{{3}}}}}
| [[:Category:{{{1}}}{{lcs}}|<span style="color: #{{Header/linkcolor|{{{1}}}}};">{{Check title|{{{1}}}|Category|{{Subpage|slash=false}}|true={{{1}}}}}</span>]] >&nbsp;
  }} >&nbsp;}}{{#if: {{{4|}}}|{{ll|:Category:{{{4}}}|{{#if:{{lcs}}|{{#getdisplaytitle: Category:{{{4}}}{{lcs}} }}|{{{4}}}}}
}}{{#if:{{{2|}}}
  }} >&nbsp;}}{{#if: {{{5|}}}|{{ll|:Category:{{{5}}}|{{#if:{{lcs}}|{{#getdisplaytitle: Category:{{{5}}}{{lcs}} }}|{{{5}}}}}
| [[:Category:{{{2}}}{{lcs}}|<span style="color: #{{Header/linkcolor|{{{1}}}}};">{{Check title|{{{2}}}|Category|{{Subpage|slash=false}}|true={{{2}}}}}</span>]] >&nbsp;
  }} >&nbsp;}}{{#if: {{{6|}}}|{{ll|:Category:{{{6}}}|{{#if:{{lcs}}|{{#getdisplaytitle: Category:{{{6}}}{{lcs}} }}|{{{6}}}}}
}}{{#if:{{{3|}}}
   }} >&nbsp;}}'''{{#if:{{lcs}}|{{#getdisplaytitle: {{FULLPAGENAME}} }}|{{PAGENAME}}}}'''<!--
| [[:Category:{{{3}}}{{lcs}}|<span style="color: #{{Header/linkcolor|{{{1}}}}};">{{Check title|{{{3}}}|Category|{{Subpage|slash=false}}|true={{{3}}}}}</span>]] >&nbsp;
  --></div>
}}{{#if:{{{4|}}}
{{#if: {{{hidecat|}}}|
| [[:Category:{{{4}}}{{lcs}}|<span style="color: #{{Header/linkcolor|{{{1}}}}};">{{Check title|{{{4}}}|Category|{{Subpage|slash=false}}|true={{{4}}}}}</span>]] >&nbsp;
| {{#ifeq: {{FULLROOTPAGENAME}}|Category:Main
}}{{#if:{{{5|}}}
| <!-- if current page equals `Category:Main(/xx)`, don't add category -->
| [[:Category:{{{5}}}{{lcs}}|<span style="color: #{{Header/linkcolor|{{{1}}}}};">{{Check title|{{{5}}}|Category|{{Subpage|slash=false}}|true={{{5}}}}}</span>]] >&nbsp;
| {{ll|Category:<!--
}}{{#if:{{{6|}}}
  -->{{#if:{{{6|}}}|{{{6}}}
| [[:Category:{{{6}}}{{lcs}}|<span style="color: #{{Header/linkcolor|{{{1}}}}};">{{Check title|{{{6}}}|Category|{{Subpage|slash=false}}|true={{{6}}}}}</span>]] >&nbsp;
  |{{#if:{{{5|}}}|{{{5}}}
}}'''{{Check title|{{FULLPAGENAME}}|true={{BASEPAGENAME}}}}'''
  |{{#if:{{{4|}}}|{{{4}}}
</div>
  |{{#if:{{{3|}}}|{{{3}}}
<div style="white-space: nowrap; float: right;">
  |{{#if:{{{2|}}}|{{{2}}}
{{#if:{{{hidever|}}}
  |{{#if:{{{1|}}}|{{{1}}}
|| [[Version history{{lcs}}|<span style="color: #{{Header/linkcolor|{{{1}}}}};">'''{{Translation|Page updated}}:'''</span>]] {{#if:{{{version|}}}
  |Main}} }} }} }} }} }}}}
  | [[:Category:{{{version}}}{{lcs}}|<span style="color: #{{Header/linkcolor|{{{1}}}}};">{{{version}}}{{#if:{{{incver|}}}|.{{{incver}}}}}</span>]]
   }}{{Language code category}} <!-- if hidecat is blank, add page to language code category -->
   | [[:Category:Unknown Version{{lcs}}|<span style="color: #{{Header/linkcolor|{{{1}}}}};">{{Check title|Unknown Version|Category|{{Subpage|slash=false}}|true={{Translation|Unknown Version}}}}</span>]]
}}</div></includeonly>
  }}
}}
</div>
|}
{{#if:{{{hidebody|}}}
|  <!-- table end -->
| <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>
-->{{#if:{{{hidecat|}}}|
| {{#if:{{{hidever|}}}|
  | [[Category:{{{version}}}.{{{incver}}}{{lcs}}]]
  }}{{#ifeq:{{FULLROOTPAGENAME}}|Category:Main
  | <!-- if current page equals `Category:Main(/xx)`, don't add category -->
  | [[Category:{{#if:{{{6|}}}|{{{6}}}
    | {{#if:{{{5|}}}|{{{5}}}
    | {{#if:{{{4|}}}|{{{4}}}
    | {{#if:{{{3|}}}|{{{3}}}
    | {{#if:{{{2|}}}|{{{2}}}
    | {{#if:{{{1|}}}|{{{1}}}
    | Main}} }} }} }} }} }}{{lcs}}]]
   }}
}}</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.