Template

Pagetabs

From Dogcraft Wiki

m (Bringing this in line with pagetabs2)
(adding templatestyles)
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
<includeonly><div class="vdesktop noexcerpt" style="width:100%; height: 50px; border-bottom: 5px solid #8b0024;">
<includeonly>
  {{#if: {{{tab1|}}}
<templatestyles src="Pagetabs/styles.css" /><div class="pagetabs noexcerpt noscrollbar"><!--
      |<div style="width:5px; height: 50px; border-bottom: 5px solid #8b0024; background: #ffffff; float:left;"></div>
--><div>[[{{{tab1|}}}|{{{title1|{{{tab1|}}}}}}]]</div><!--
      <div style="width:19%; height: 50px; border-style:solid; border-color: #8b0024; border-width: 5px; float:left; text-align:center;
--><div>[[{{{tab2|}}}|{{{title2|{{{tab2|}}}}}}]]</div><!--
      padding-top:7px;
-->{{#if:{{{tab3|}}}|<div>[[{{{tab3|}}}|{{{title3|{{{tab3|}}}}}}]]</div>}}<!--
      {{#ifeq: {{{currenttab|}}} | 1
-->{{#if:{{{tab4|}}}|<div>[[{{{tab4|}}}|{{{title4|{{{tab4|}}}}}}]]</div>}}<!--
        |border-bottom: 5px solid #ffffff; background: #ffffff;">[[{{{tab1|}}}|<span style="color:black;">'''{{{tab1text|{{{tab1|}}}}}}''']]
-->{{#if:{{{tab5|}}}|<div>[[{{{tab5|}}}|{{{title5|{{{tab5|}}}}}}]]</div>}}<!--
        |background: #8b0024;">[[{{{tab1|}}}|<span style="color:white;">'''{{{tab1text|{{{tab1|}}}}}}''']]
--></div>
      }}
<hr /></includeonly><noinclude>
      </div>
==Pagetabs template==
      |
This template was originally created for use on user pages.
  }}
 
  {{#if: {{{tab2|}}}
 
      |<div style="width:5px; height: 50px; border-bottom: 5px solid #8b0024; background: #ffffff; float:left;"></div>
This template creates a row of at most 5 tabs with (internal) links, meant to ease navigation between related and sub-pages. External links may only be included trough interwiki prefixes. The current page should also be included as a tab to maintain navigation in all directions.
      <div style="width:19%; height: 50px; border-style:solid; border-color: #8b0024; border-width: 5px; float:left; text-align:center;
Tabs left blank are excluded. The first 2 tabs are required.
      padding-top:7px;
If a title field is left blank, the associated tab (link) field will be included instead.
      {{#ifeq: {{{currenttab|}}} | 2
 
        |border-bottom: 5px solid #ffffff; background: #ffffff;">[[{{{tab2|}}}|<span style="color:black;">'''{{{tab2text|{{{tab2|}}}}}}''']]
 
        |background: #8b0024;">[[{{{tab2|}}}|<span style="color:white;">'''{{{tab2text|{{{tab2|}}}}}}''']]
The implementation of this template was in part inspired by the Hollow Knight wiki's [https://hollowknight.fandom.com/wiki/Template:Navbar Template:Navbar].
      }}
===Example===
      </div>
<pre><nowiki>{{pagetabs
      |
|tab1    = {{FULLPAGENAME}}
  }}
|title1  = Pagetabs
  {{#if: {{{tab3|}}}
|tab2    = dc:Announcements
      |<div style="width:5px; height: 50px; border-bottom: 5px solid #8b0024; background: #ffffff; float:left;"></div>
|title2  = Announcements
      <div style="width:19%; height: 50px; border-style:solid; border-color: #8b0024; border-width: 5px; float:left; text-align:center;
|tab3    = Special:History/{{FULLPAGENAME}}
      padding-top:7px;
|title3  = History
      {{#ifeq: {{{currenttab|}}} | 3
|tab5     = Main Page
        |border-bottom: 5px solid #ffffff; background: #ffffff;">[[{{{tab3|}}}|<span style="color:black;">'''{{{tab3text|{{{tab3|}}}}}}''']]
}}</nowiki></pre> generates: {{pagetabs
        |background: #8b0024;">[[{{{tab3|}}}|<span style="color:white;">'''{{{tab3text|{{{tab3|}}}}}}''']]
|tab1     = {{FULLPAGENAME}}
      }}
|title1   = Pagetabs
      </div>
|tab2     = dc:Announcements
      |
|title2   = Announcements
  }}
|tab3     = Special:History/{{FULLPAGENAME}}
  {{#if: {{{tab4|}}}
|title3   = History
      |<div style="width:5px; height: 50px; border-bottom: 5px solid #8b0024; background: #ffffff; float:left;"></div>
|tab5     = Main Page
      <div style="width:19%; height: 50px; border-style:solid; border-color: #8b0024; border-width: 5px; float:left; text-align:center;
      padding-top:7px;
      {{#ifeq: {{{currenttab|}}} | 4
        |border-bottom: 5px solid #ffffff; background: #ffffff;">[[{{{tab4|}}}|<span style="color:black;">'''{{{tab4text|{{{tab4|}}}}}}''']]
        |background: #8b0024;">[[{{{tab4|}}}|<span style="color:white;">'''{{{tab4text|{{{tab4|}}}}}}''']]
      }}
      </div>
      |
  }}
  {{#if: {{{tab5|}}}
      |<div style="width:5px; height: 50px; border-bottom: 5px solid #8b0024; background: #ffffff; float:left;"></div>
      <div style="width:19%; height: 50px; border-style:solid; border-color: #8b0024; border-width: 5px; float:left; text-align:center;
      padding-top:7px;
      {{#ifeq: {{{currenttab|}}} | 5
        |border-bottom: 5px solid #ffffff; background: #ffffff;">[[{{{tab5|}}}|<span style="color:black;">'''{{{tab5text|{{{tab5|}}}}}}''']]
        |background: #8b0024;">[[{{{tab5|}}}|<span style="color:white;">'''{{{tab5text|{{{tab5|}}}}}}''']]
      }}
      </div>
      |
  }}
</div>
{| class="vmobile noexcerpt" style="background: #8b0024;"
|style="text-align: center; height: 50px;" |{{#if: {{{tab1|}}}
  |{{#ifeq: {{{currenttab|}}} | 1
      |[[{{{tab1|}}}|<span style="color:black;">'''{{{tab1text|{{{tab1|}}}}}}''']]
      |[[{{{tab1|}}}|<span style="color:white;">'''{{{tab1text|{{{tab1|}}}}}}''']]
  }}
  |
}}
|style="text-align: center; height: 50px;" |{{#if: {{{tab2|}}}
  |{{#ifeq: {{{currenttab|}}} | 2  
      |[[{{{tab2|}}}|<span style="color:black;">'''{{{tab2text|{{{tab2|}}}}}}''']]
      |[[{{{tab2|}}}|<span style="color:white;">'''{{{tab2text|{{{tab2|}}}}}}''']]
  }}
  |
}}
|style="text-align: center; height: 50px;" |{{#if: {{{tab3|}}}
  |{{#ifeq: {{{currenttab|}}} | 3
      |[[{{{tab3|}}}|<span style="color:black;">'''{{{tab3text|{{{tab3|}}}}}}''']]
      |[[{{{tab3|}}}|<span style="color:white;">'''{{{tab3text|{{{tab3|}}}}}}''']]
  }}
  |
}}
|style="text-align: center; height: 50px;" |{{#if: {{{tab4|}}}
  |{{#ifeq: {{{currenttab|}}} | 4
      |[[{{{tab4|}}}|<span style="color:black;">'''{{{tab4text|{{{tab4|}}}}}}''']]
      |[[{{{tab4|}}}|<span style="color:white;">'''{{{tab4text|{{{tab4|}}}}}}''']]
  }}
  |
}}
|style="text-align: center; height: 50px;" |{{#if: {{{tab5|}}}
  |{{#ifeq: {{{currenttab|}}} | 5
      |[[{{{tab5|}}}|<span style="color:black;">'''{{{tab5text|{{{tab5|}}}}}}''']]
      |[[{{{tab5|}}}|<span style="color:white;">'''{{{tab5text|{{{tab5|}}}}}}''']]
  }}
  |
}}
|
|}</includeonly><noinclude>
{{pagetabs
|tab1       = User:{{ROOTPAGENAME}}
|tab1text   = User Page
|tab2       = User:{{ROOTPAGENAME}}/Trophies
|tab2text   = Trophies
|tab3       = Special:Contributions/{{ROOTPAGENAME}}
|tab3text   = Contributions
|tab5       = Tab 5
|currenttab = 2
}}
}}
===Template Data===
<templatedata>
{
"params": {
"tab1": {
"label": "Tab 1",
"description": "Link to the target page of the first tab. May be a page name, interwiki-prefixed page name or a magic name variable.",
"example": "Main_Page, {{FULLPAGENAME}}, dc:Announcements",
"type": "wiki-page-name",
"required": true,
"suggested": true
},
"title1": {
"label": "Title 1",
"description": "Title text of the first tab.",
"example": "Main page",
"type": "string",
"suggested": true
},
"tab2": {
"label": "Tab 2",
"description": "Link to the target page of the second tab. May be a page name, interwiki-prefixed page name or a magic name variable.",
"example": "Main_Page, {{FULLPAGENAME}}, dc:Announcements",
"type": "wiki-page-name",
"required": true,
"suggested": true
},
"title2": {
"label": "Title 2",
"description": "Title text of the second tab.",
"example": "Main page",
"type": "string",
"suggested": true
},
"tab3": {
"label": "Tab 3",
"description": "Link to the target page of the third tab. May be a page name, interwiki-prefixed page name or a magic name variable.",
"example": "Main_Page, {{FULLPAGENAME}}, dc:Announcements",
"type": "wiki-page-name",
"suggested": true
},
"title3": {
"label": "Title 3",
"description": "Title text of the third tab.",
"example": "Main page",
"type": "string",
"suggested": true
},
"tab4": {
"label": "Tab 4",
"description": "Link to the target page of the fourth tab. May be a page name, interwiki-prefixed page name or a magic name variable.",
"example": "Main_Page, {{FULLPAGENAME}}, dc:Announcements",
"type": "wiki-page-name",
"suggested": true
},
"title4": {
"label": "Title 4",
"description": "Title text of the fourth tab.",
"example": "Main page",
"type": "string",
"suggested": true
},
"tab5": {
"label": "Tab 5",
"description": "Link to the target page of the fifth tab. May be a page name, interwiki-prefixed page name or a magic name variable.",
"example": "Main_Page, {{FULLPAGENAME}}, dc:Announcements",
"type": "wiki-page-name",
"suggested": true
},
"title5": {
"label": "Title 5",
"description": "Title text of the fifth tab.",
"example": "Main page",
"type": "string",
"suggested": true
}
},
"description": "This template creates a row of at most 5 tabs with (internal) links, meant to ease navigation between related and sub-pages. External links may only be included trough interwiki prefixes. The current page should also be included as a tab to maintain navigation in all directions. Blank tabs are excluded.",
"format": "block"
}
</templatedata>
</noinclude>

Revision as of 23:41, 2 July 2022

Pagetabs template

This template was originally created for use on user pages.


This template creates a row of at most 5 tabs with (internal) links, meant to ease navigation between related and sub-pages. External links may only be included trough interwiki prefixes. The current page should also be included as a tab to maintain navigation in all directions. Tabs left blank are excluded. The first 2 tabs are required. If a title field is left blank, the associated tab (link) field will be included instead.


The implementation of this template was in part inspired by the Hollow Knight wiki's Template:Navbar.

Example

{{pagetabs
|tab1     = {{FULLPAGENAME}}
|title1   = Pagetabs
|tab2     = dc:Announcements
|title2   = Announcements
|tab3     = Special:History/{{FULLPAGENAME}}
|title3   = History
|tab5     = Main Page
}}

generates:


Template Data

This template creates a row of at most 5 tabs with (internal) links, meant to ease navigation between related and sub-pages. External links may only be included trough interwiki prefixes. The current page should also be included as a tab to maintain navigation in all directions. Blank tabs are excluded.

Template parameters

This template prefers block formatting of parameters.

ParameterDescriptionTypeStatus
Tab 1tab1

Link to the target page of the first tab. May be a page name, interwiki-prefixed page name or a magic name variable.

Example
Main_Page, {{FULLPAGENAME}}, dc:Announcements
Page namerequired
Title 1title1

Title text of the first tab.

Example
Main page
Stringsuggested
Tab 2tab2

Link to the target page of the second tab. May be a page name, interwiki-prefixed page name or a magic name variable.

Example
Main_Page, {{FULLPAGENAME}}, dc:Announcements
Page namerequired
Title 2title2

Title text of the second tab.

Example
Main page
Stringsuggested
Tab 3tab3

Link to the target page of the third tab. May be a page name, interwiki-prefixed page name or a magic name variable.

Example
Main_Page, {{FULLPAGENAME}}, dc:Announcements
Page namesuggested
Title 3title3

Title text of the third tab.

Example
Main page
Stringsuggested
Tab 4tab4

Link to the target page of the fourth tab. May be a page name, interwiki-prefixed page name or a magic name variable.

Example
Main_Page, {{FULLPAGENAME}}, dc:Announcements
Page namesuggested
Title 4title4

Title text of the fourth tab.

Example
Main page
Stringsuggested
Tab 5tab5

Link to the target page of the fifth tab. May be a page name, interwiki-prefixed page name or a magic name variable.

Example
Main_Page, {{FULLPAGENAME}}, dc:Announcements
Page namesuggested
Title 5title5

Title text of the fifth tab.

Example
Main page
Stringsuggested
This page was last modified on 2 July 2022, at 23:41. (5 months ago)