Template:ItemIcon: Difference between revisions

From Melvor Idle
(Added override to allow changing of link.)
(Slight templating change, also added ext optional argument for overriding when necessary.)
Line 3: Line 3:
Adding a second argument allows you to override the text. For example, <nowiki>{{ItemIcon|Generous Harvest Potion I|Generous Harvest Potion}}</nowiki> gives {{ItemIcon|Generous Harvest Potion I|Generous Harvest Potion}}
Adding a second argument allows you to override the text. For example, <nowiki>{{ItemIcon|Generous Harvest Potion I|Generous Harvest Potion}}</nowiki> gives {{ItemIcon|Generous Harvest Potion I|Generous Harvest Potion}}


Optionally, you can set the 'ext' argument for the rare items that have non-SVG extensions. For example, <nowiki>{{ItemIcon|Crown of Rhaelyx|ext=png}}</nowiki> gives {{ItemIcon|Crown of Rhaelyx|ext=png}}


<onlyinclude>{{#if:{{{2|}}}|[[File:{{{1}}} (item).svg|25px|link={{{1}}}]]&nbsp;[[{{{1}}}|{{{2}}}]]|[[File:{{{1}}} (item).svg|25px|link={{{1}}}]]&nbsp;[[{{{1}}}]]}}</onlyinclude>
 
<includeonly><onlyinclude>[[File:{{{1}}} (item).{{{ext|svg}}}|25px|link={{{1}}}]]&nbsp;[[{{{1}}}{{#if:{{{2|}}}|{{!}}{{{2}}}}}]]</onlyinclude></includonly>

Revision as of 15:52, 10 August 2020

A template for quickly building item links with icons. For example, {{ItemIcon|Compost}} becomes Compost (item).svg Compost.

Adding a second argument allows you to override the text. For example, {{ItemIcon|Generous Harvest Potion I|Generous Harvest Potion}} gives Generous Harvest Potion I (item).svg Generous Harvest Potion

Optionally, you can set the 'ext' argument for the rare items that have non-SVG extensions. For example, {{ItemIcon|Crown of Rhaelyx|ext=png}} gives Crown of Rhaelyx (item).png Crown of Rhaelyx