Template:Item icon/doc: Difference between revisions

From Stalburg Wiki
Jump to navigation Jump to search
(Created page with "== Summary == <templatedata> { "params": { "1": { "aliases": [ "page" ], "label": "Page Name", "description": "The name for the target page.", "example": "Page Name", "type": "wiki-page-name", "required": true }, "2": { "aliases": [ "label" ], "label": "Link Label", "description": "The text to the be displayed on the link icon's label.", "example": "Alternative Page Name", "type": "line" } }, "description": "Use t...")
 
 
Line 29: Line 29:


== Examples ==
== Examples ==
For the examples below, <code><nowiki>File:Mystic Feather (Item).png</nowiki></code> was used as the icon for a page called <code>Mystic Feather</code>.
For the examples below, <code><nowiki>File:12440_Steel_Bar.png</nowiki></code> was used as the icon for a page called <code>Steel Bar</code>.
{| class="wikitable"
{| class="wikitable"
! Code !! Result
! Code !! Result
|-
|-
| <code><nowiki>{{Item icon|Mystic Feather}}</nowiki></code> || {{Item icon|Mystic Feather}}
| <code><nowiki>{{Item icon|Steel Bar}}</nowiki></code> || {{Item icon|Steel Bar}}
|-
|-
| <code><nowiki>{{Item icon|Mystic Feather|Mystic Feathers}}</nowiki></code> || {{Item icon|Mystic Feather|Mystic Feathers}}
| <code><nowiki>{{Item icon|Steel Bar|Steel Bar}}</nowiki></code> || {{Item icon|Steel Bar|Steel Bar}}
|-
|-
| <code><nowiki>{{Item icon|Mystic Feather|notext}}</nowiki></code> || {{Item icon|Mystic Feather|notext}}
| <code><nowiki>{{Item icon|Steel Bar|notext}}</nowiki></code> || {{Item icon|Steel Bar|notext}}
|-
|-
| <code><nowiki>{{Item icon|Missing Item}}</nowiki></code> (Missing Page Icon) || {{Item icon|Missing Item}}
| <code><nowiki>{{Item icon|Missing Item}}</nowiki></code> (Missing Page Icon) || {{Item icon|Missing Item}}
|}
|}
== Dependencies==
== Dependencies==
For this template to work properly, you need the following:
For this template to work properly, you need the following:
* The base {{tl|Link icon}} template.
* The base {{tl|Link icon}} template.
* The <code>.link-icon</code> class and any related classes, found in [[MediaWiki:Common.css]].
* The <code>.link-icon</code> class and any related classes, found in [[MediaWiki:Common.css]].

Latest revision as of 05:02, 3 March 2025

Summary[edit source]

Use this template to display an icon next to a page link. This template assumes that each page has an icon uploaded at a specific location, namely "File:Page Name (Item).png".

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
Page Name1 page

The name for the target page.

Example
Page Name
Page namerequired
Link Label2 label

The text to the be displayed on the link icon's label.

Example
Alternative Page Name
Lineoptional

Examples[edit source]

For the examples below, File:12440_Steel_Bar.png was used as the icon for a page called Steel Bar.

Code Result
{{Item icon|Steel Bar}} Steel Bar}}{{#vardefine:display|Steel Bar}}{{#vardefine:iconSize|1.2em}}{{#vardefine:lineHeight|1lh}}{{#vardefine:fileExists|}}[[File:{{#var:target}} (Item).png|link={{#var:target}}|alt=]] [[{{#var:target}}|{{#var:display}}]]
{{Item icon|Steel Bar|Steel Bar}} Steel Bar}}{{#vardefine:display|Steel Bar}}{{#vardefine:iconSize|1.2em}}{{#vardefine:lineHeight|1lh}}{{#vardefine:fileExists|}}[[File:{{#var:target}} (Item).png|link={{#var:target}}|alt=]] [[{{#var:target}}|{{#var:display}}]]
{{Item icon|Steel Bar|notext}} Steel Bar}}{{#vardefine:display|notext}}{{#vardefine:iconSize|1.2em}}{{#vardefine:lineHeight|1lh}}{{#vardefine:fileExists|}}[[File:{{#var:target}} (Item).png|link={{#var:target}}|alt=]]
{{Item icon|Missing Item}} (Missing Page Icon) Missing Item}}{{#vardefine:display|Missing Item}}{{#vardefine:iconSize|1.2em}}{{#vardefine:lineHeight|1lh}}{{#vardefine:fileExists|}}[[File:{{#var:target}} (Item).png|link={{#var:target}}|alt=]] [[{{#var:target}}|{{#var:display}}]]

Dependencies[edit source]

For this template to work properly, you need the following: