Template:IconLink: Difference between revisions

From Ephinea PSO Wiki
m (broke something but fixed it probably)
mNo edit summary
 
(3 intermediate revisions by the same user not shown)
Line 13: Line 13:
| red
| red
| native
| native
| abeast
| abeast
| ab
| ab
| machine
| machine
Line 20: Line 20:
| glow = {{#if:{{{nolink|}}}|{{Link|icon={{{1}}}|color={{{2|}}}|{{{3|}}}|{{{4|}}}|nolink=1}}|{{#ifeq:{{{3|}}}|{{PAGENAME}}|'''{{Link|icon={{{1}}}|color={{{2|}}}|{{{3|}}}|{{{4|}}}|nolink=1}}'''|{{Link|icon={{{1}}}|color={{{2|}}}|{{{3|}}}|{{{4|}}}}}}}}}
| glow = {{#if:{{{nolink|}}}|{{Link|icon={{{1}}}|color={{{2|}}}|{{{3|}}}|{{{4|}}}|nolink=1}}|{{#ifeq:{{{3|}}}|{{PAGENAME}}|'''{{Link|icon={{{1}}}|color={{{2|}}}|{{{3|}}}|{{{4|}}}|nolink=1}}'''|{{Link|icon={{{1}}}|color={{{2|}}}|{{{3|}}}|{{{4|}}}}}}}}}
| #default = {{#if:{{{nolink|}}}|{{Link|icon={{{1}}}|color=link|{{{2|}}}|{{{3|}}}|nolink=1}}|{{#ifeq:{{{2|}}}|{{PAGENAME}}|'''{{Link|icon={{{1}}}|color=link|{{{2|}}}|{{{3|}}}|nolink=1}}'''|{{Link|icon={{{1}}}|color=link|{{{2|}}}|{{{3|}}}}}}}}}}}<noinclude>
| #default = {{#if:{{{nolink|}}}|{{Link|icon={{{1}}}|color=link|{{{2|}}}|{{{3|}}}|nolink=1}}|{{#ifeq:{{{2|}}}|{{PAGENAME}}|'''{{Link|icon={{{1}}}|color=link|{{{2|}}}|{{{3|}}}|nolink=1}}'''|{{Link|icon={{{1}}}|color=link|{{{2|}}}|{{{3|}}}}}}}}}}}<noinclude>
==Usage and example==
==Usage==
This template accepts up to 4 numbered parameters and an additional <code>nolink</code> parameter.
 
The first parameter is the icon the link will be rendered with; for example, <code><nowiki>{{IconLink|sword}}</nowiki></code> will generate a link with a [[File:Sword icon.png|16px]] icon in front of it. This parameter must match with an image name – for example, <code><nowiki>{{IconLink|booma}}</nowiki></code> matches <code><nowiki>Booma.png</nowiki></code> – or the link won't render properly. This template was made to be used with the specific icon images on this wiki – for example, <code><nowiki>{{IconLink|gun}}</nowiki></code> will automatically use <code><nowiki>Gun icon.png</nowiki></code> – however, any image is technically usable, and will be resized to a 16-pixel-wide image.
 
The second parameter ''may'' be a color, but this is optional. Supported colors are <span class="link">link</span>, <span class="normal">normal</span>, <span class="white">white</span>, <span class="attributes">attributes</span>, <span class="green">green</span>, <span class="untekked">untekked</span>, <span class="cyan">cyan</span>, <span class="blue">blue</span>, <span class="rare">rare</span>, <span class="yellow">yellow</span>, <span class="es">es</span>, <span class="red">red</span>, <span class="native">native</span>, <span class="abeast">abeast</span>, <span class="ab">ab</span>, <span class="machine">machine</span>, <span class="dark">dark</span>, <span class="olga2">olga2</span>, and <span class="glow">glow</span>.
 
:If a different value or no value is specified, it will automatically use the <span class="link">link</span> color, and the second parameter will instead become the page that the link points to. This is useful for quickly rendering a link that doesn't need a particular text color, like for a technique; for example, a [[Handgun]] has an icon but no specific in-game text color, so using <code><nowiki>{{IconLink|gun|Handgun}}</nowiki></code> will quickly render a {{IconLink|gun|Handgun}} link. However, all items already have easier-to-use templates; see [[:Category:Link templates]] for more information.
 
If a color was specified, the third parameter is the page that the link points to; for example, <code><nowiki>{{IconLink|cane|attributes|Baton}}</nowiki></code> becomes {{IconLink|cane|attributes|Baton}}. If a color was ''not'' specified, the third parameter is the ''text of the link''; <code><nowiki>{{IconLink|gun|Handgun|Bind Handgun}}</nowiki></code> renders as {{IconLink|gun|Handgun|Bind Handgun}}.
 
The fourth parameter is optional, and only necessary if a color was specified. If this is the case, then the fourth parameter is the text of the link; <code><nowiki>{{IconLink|sword|untekked|Gladius|Demon's Gladius}}</nowiki></code> will render as {{IconLink|sword|untekked|Gladius|Demon's Gladius}}.
 
This template automatically changes itself from a link to simple bold text if the link points to the page the link is on; MediaWiki does this automatically with standalone links, but not image links, such as the icons that precede the text in this template.
 
==Examples==
<pre>{{IconLink|sword|Saber}}</pre>
<pre>{{IconLink|sword|Saber}}</pre>
{{IconLink|sword|Saber}}
{{IconLink|sword|Saber}}
Line 29: Line 44:
<pre>{{IconLink|cane|es|ES Windmill}}</pre>
<pre>{{IconLink|cane|es|ES Windmill}}</pre>
{{IconLink|cane|es|ES Windmill}}
{{IconLink|cane|es|ES Windmill}}
[[Category:Templates]]
</noinclude>

Latest revision as of 23:43, 13 August 2023

[[File:{{{1}}}.png|16px|middle|link=]][[|]]

Usage[edit source]

This template accepts up to 4 numbered parameters and an additional nolink parameter.

The first parameter is the icon the link will be rendered with; for example, {{IconLink|sword}} will generate a link with a Sword icon.png icon in front of it. This parameter must match with an image name – for example, {{IconLink|booma}} matches Booma.png – or the link won't render properly. This template was made to be used with the specific icon images on this wiki – for example, {{IconLink|gun}} will automatically use Gun icon.png – however, any image is technically usable, and will be resized to a 16-pixel-wide image.

The second parameter may be a color, but this is optional. Supported colors are link, normal, white, attributes, green, untekked, cyan, blue, rare, yellow, es, red, native, abeast, ab, machine, dark, olga2, and glow.

If a different value or no value is specified, it will automatically use the link color, and the second parameter will instead become the page that the link points to. This is useful for quickly rendering a link that doesn't need a particular text color, like for a technique; for example, a Handgun has an icon but no specific in-game text color, so using {{IconLink|gun|Handgun}} will quickly render a Gun icon.pngHandgun link. However, all items already have easier-to-use templates; see Category:Link templates for more information.

If a color was specified, the third parameter is the page that the link points to; for example, {{IconLink|cane|attributes|Baton}} becomes Cane icon.pngBaton. If a color was not specified, the third parameter is the text of the link; {{IconLink|gun|Handgun|Bind Handgun}} renders as Gun icon.pngBind Handgun.

The fourth parameter is optional, and only necessary if a color was specified. If this is the case, then the fourth parameter is the text of the link; {{IconLink|sword|untekked|Gladius|Demon's Gladius}} will render as Sword icon.pngDemon's Gladius.

This template automatically changes itself from a link to simple bold text if the link points to the page the link is on; MediaWiki does this automatically with standalone links, but not image links, such as the icons that precede the text in this template.

Examples[edit source]

{{IconLink|sword|Saber}}

Sword icon.pngSaber

{{IconLink|gun|attributes|Launcher|Charge Launcher +15}}

Gun icon.pngCharge Launcher +15

{{IconLink|unit|rare|V101}}

Unit icon.pngV101

{{IconLink|cane|es|ES Windmill}}

Cane icon.pngES Windmill