Template:Header: Difference between revisions

From PZwiki
(use documentation/sandbox, update doc)
(update)
Line 81: Line 81:
</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>{| 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}}}};"
|- valign="center"
|- valign="center"
! 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>]]
! 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>]]
| style="padding: 0 10px; color: #ffffff;" |
| style="padding: 0 10px; color: #ffffff;" |
<div style="float: left;">
<div style="float: left;">
{{#if:{{{1|}}}
{{#if:{{{1|}}}
| [[:Category:{{{1}}}{{#ifeq:{{Language code}}|true|{{Subpage}}|}}|<span style="color: #{{Header/linkcolor|{{{1}}}}};">{{Check title|{{{1}}}|Category|{{Subpage|slash=false}}|true={{{1}}}}}</span>]] >&nbsp;
| [[:Category:{{{1}}}{{lcs}}|<span style="color: #{{Header/linkcolor|{{{1}}}}};">{{Check title|{{{1}}}|Category|{{Subpage|slash=false}}|true={{{1}}}}}</span>]] >&nbsp;
}}{{#if:{{{2|}}}
}}{{#if:{{{2|}}}
| [[:Category:{{{2}}}{{#ifeq:{{Language code}}|true|{{Subpage}}|}}|<span style="color: #{{Header/linkcolor|{{{1}}}}};">{{Check title|{{{2}}}|Category|{{Subpage|slash=false}}|true={{{2}}}}}</span>]] >&nbsp;
| [[:Category:{{{2}}}{{lcs}}|<span style="color: #{{Header/linkcolor|{{{1}}}}};">{{Check title|{{{2}}}|Category|{{Subpage|slash=false}}|true={{{2}}}}}</span>]] >&nbsp;
}}{{#if:{{{3|}}}
}}{{#if:{{{3|}}}
| [[:Category:{{{3}}}{{#ifeq:{{Language code}}|true|{{Subpage}}|}}|<span style="color: #{{Header/linkcolor|{{{1}}}}};">{{Check title|{{{3}}}|Category|{{Subpage|slash=false}}|true={{{3}}}}}</span>]] >&nbsp;
| [[:Category:{{{3}}}{{lcs}}|<span style="color: #{{Header/linkcolor|{{{1}}}}};">{{Check title|{{{3}}}|Category|{{Subpage|slash=false}}|true={{{3}}}}}</span>]] >&nbsp;
}}{{#if:{{{4|}}}
}}{{#if:{{{4|}}}
| [[:Category:{{{4}}}{{#ifeq:{{Language code}}|true|{{Subpage}}|}}|<span style="color: #{{Header/linkcolor|{{{1}}}}};">{{Check title|{{{4}}}|Category|{{Subpage|slash=false}}|true={{{4}}}}}</span>]] >&nbsp;
| [[:Category:{{{4}}}{{lcs}}|<span style="color: #{{Header/linkcolor|{{{1}}}}};">{{Check title|{{{4}}}|Category|{{Subpage|slash=false}}|true={{{4}}}}}</span>]] >&nbsp;
}}{{#if:{{{5|}}}
}}{{#if:{{{5|}}}
| [[:Category:{{{5}}}{{#ifeq:{{Language code}}|true|{{Subpage}}|}}|<span style="color: #{{Header/linkcolor|{{{1}}}}};">{{Check title|{{{5}}}|Category|{{Subpage|slash=false}}|true={{{5}}}}}</span>]] >&nbsp;
| [[:Category:{{{5}}}{{lcs}}|<span style="color: #{{Header/linkcolor|{{{1}}}}};">{{Check title|{{{5}}}|Category|{{Subpage|slash=false}}|true={{{5}}}}}</span>]] >&nbsp;
}}{{#if:{{{6|}}}
}}{{#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;
| [[:Category:{{{6}}}{{lcs}}|<span style="color: #{{Header/linkcolor|{{{1}}}}};">{{Check title|{{{6}}}|Category|{{Subpage|slash=false}}|true={{{6}}}}}</span>]] >&nbsp;
}}'''{{Check title|{{FULLPAGENAME}}|true={{CATBASEPAGENAME}}}}'''
}}'''{{Check title|{{FULLPAGENAME}}|true={{CATBASEPAGENAME}}}}'''
</div>
</div>
<div style="white-space: nowrap; float: right;">
<div style="white-space: nowrap; float: right;">
{{#if:{{{hidever|}}}
{{#if:{{{hidever|}}}
|| [[Version history{{#ifeq:{{Language code}}|true|{{#ifexist:Version history{{Subpage}}|{{Subpage}}|}}|}}|<span style="color: #{{Header/linkcolor|{{{1}}}}};">'''{{Translation|Page updated}}:'''</span>]] {{#if:{{{version|}}}
|| [[Version history{{lcs}}|<span style="color: #{{Header/linkcolor|{{{1}}}}};">'''{{Translation|Page updated}}:'''</span>]] {{#if:{{{version|}}}
   | [[:Category:{{{version}}}{{#ifeq:{{Language code}}|true|{{Subpage}}|}}|<span style="color: #{{Header/linkcolor|{{{1}}}}};">{{{version}}}{{#if:{{{incver|}}}|.{{{incver}}}}}</span>]]
   | [[:Category:{{{version}}}{{lcs}}|<span style="color: #{{Header/linkcolor|{{{1}}}}};">{{{version}}}{{#if:{{{incver|}}}|.{{{incver}}}}}</span>]]
   | [[: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>]]
   | [[:Category:Unknown Version{{lcs}}|<span style="color: #{{Header/linkcolor|{{{1}}}}};">{{Check title|Unknown Version|Category|{{Subpage|slash=false|true={{Translate|Unknown Version}}}}}}</span>]]
   }}
   }}
}}
}}
Line 113: Line 113:
-->{{#if:{{{hidecat|}}}|
-->{{#if:{{{hidecat|}}}|
| {{#if:{{{hidever|}}}|
| {{#if:{{{hidever|}}}|
   | [[Category:{{{version|Unknown Version}}}{{#ifeq:{{Language code}}|true|{{Subpage}}|}}]]
   | [[Category:{{{version|Unknown Version}}}{{lcs}}]]
   }}{{#ifeq:{{FULLROOTPAGENAME}}|Category:Main
   }}{{#ifeq:{{FULLROOTPAGENAME}}|Category:Main
   | <!-- if current page equals `Category:Main(/xx)`, don't add category -->
   | <!-- if current page equals `Category:Main(/xx)`, don't add category -->
Line 122: Line 122:
     | {{#if:{{{2|}}}|{{{2}}}
     | {{#if:{{{2|}}}|{{{2}}}
     | {{#if:{{{1|}}}|{{{1}}}
     | {{#if:{{{1|}}}|{{{1}}}
     | Main}} }} }} }} }} }}{{#ifeq:{{Language code}}|true|{{Subpage}}|}}]]
     | Main}} }} }} }} }} }}{{lcs}}]]
   }}
   }}
}}</includeonly>
}}</includeonly>

Revision as of 17:03, 30 December 2023

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 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.

Usage

This template must be placed at the top of a page, under the {{Languages}} template, if it is present.

{{Header|First-level category|Second-level category|Third-level category|etc.|version=Version 41|incver=78.16}}

Parameters

1 - 6
The name of each categories leading up to the item/page, omitting Category:. This will add the page to the last category. Will add the page to the top category of the wiki if all parameters are empty.
version
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 Unknown Version if empty.
incver
The incremental (minor) PZ version this page's content is up to date to.
hidebody
If not empty the template will not display the body (background), only displaying the header.
hidever
If not empty the template will not display the version number.
hidecat
If not empty the template will not add the page to the categories defined in 1 to 6.

Background color

The background color is automatically set based on the category in the first anonymous parameter (1).

There are currently 2 color schemes, known as: Zomboid red and Community blue. These are taken from the {{Infobox nc}} template.

Community categories

The following categories will result in the blue color scheme.

Translating

Many parts of this template are auto-translated using the {{Translation}} template or {{DISPLAYTITLE}} magic word. It is not necessary to translate this template to a language subpage, it is sufficient to just use {{Header}}.

Translation template

Static elements can be translated in the {{Translation}} template. If they're not already present, include and translate the below. Translations go after the equals (=) sign.

| Navigation = 
| Page updated = 
| Unknown Version =

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.

Ensure you've added the language code subpage.

Examples

{{Header|Community|Modding|hidever=true}}

Will produce:

Top category tree Navigation:

[[:Category:Community|Template:Check title]] > [[:Category:Modding|Template:Check title]] > Template:Check title

A whole page's worth of content in here.

And

{{Header|The Game World|Items|Weapons|version=Version 41|incver=78.16}}

Will produce:

Top category tree Navigation:

[[:Category:The Game World|Template:Check title]] > [[:Category:Items|Template:Check title]] > [[:Category:Weapons|Template:Check title]] > Template:Check title

Another page of content in here.

FAQs

Q: How to translate this template?
A: To translate the template, don't create a language version, just use the {{Header}} and not {{Header/xx}} and translate the respective words in Template:Translation for your language.

Q: Why is there a </div> missing in the template?
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 {{Clear}} template to the bottom of the page.

Q: Why do I need to use version and incver when adding the page's version?
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 Category:Version 36, Category:Version 36.1, 36.2, 36.3… You see where this is going.

Updated 23/10/2023. incver now included in version category.

See also

Editors can experiment in this template's sandbox.