Template:Skill icon: Difference between revisions

From FHX Wiki
(added if condition that checks for png or gif file and displays missing icon if no)
mNo edit summary
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
<noinclude>{{Page warning|message=This template is in draft.}}</noinclude><includeonly>[[File:{{#ifexist: File:{{{1}}} icon.png|{{{1}}} icon.png|{{#ifexist: File:{{{1}}} icon.gif|{{{1}}} icon.gif|missing icon.png}}}}|{{#switch:{{{2}}}|big=50|huge=100|#default=32}}px|link={{{1}}}]] [[{{{1}}}]]</includeonly><noinclude>
<includeonly>[[File:{{#ifexist: File:{{{1}}} icon.png|{{{1}}} icon.png|{{#ifexist: File:{{{1}}} icon.gif|{{{1}}} icon.gif|missing icon.png}}}}|{{#switch:{{{2}}}|big=50|huge=100|#default=32}}px|link={{#if:{{{3|}}}|{{{3}}}|{{{1}}}}}]] [[{{#if:{{{3|}}}|{{{3}}}{{!}}{{{1}}}|{{{1}}}}}]]</includeonly><noinclude>
== Description ==
== Description ==
<pre>{{skill icon|<skill name>}}</pre>
<pre>{{skill icon|<skill name>|<size>|<alternate page link>}}</pre>


Displays a link to the skill and adds a skill icon in front of it.
Displays a link to the skill and adds a skill icon in front of it.
Line 10: Line 10:
;2 ''(unnamed parameter)''
;2 ''(unnamed parameter)''
: Icon size. Options: "big" (48px), "huge" (100px), or, blank (32px) - which is the default size.
: Icon size. Options: "big" (48px), "huge" (100px), or, blank (32px) - which is the default size.
;3 ''(unnamed parameter)''
: Alternate page link. Include if skill needs disambiguation from another page (e.g. the Paladin Hammer skill should not link to the Hammer item page).


== Examples ==
== Examples ==
Line 20: Line 22:
* {{skill icon|Invite}} is produced from <code><nowiki>{{skill icon|Invite}}</nowiki></code>
* {{skill icon|Invite}} is produced from <code><nowiki>{{skill icon|Invite}}</nowiki></code>
* {{skill icon|Party Recall}} is produced from <code><nowiki>{{skill icon|Party Recall}}</nowiki></code>
* {{skill icon|Party Recall}} is produced from <code><nowiki>{{skill icon|Party Recall}}</nowiki></code>
* {{skill icon|Hammer (skill)}} is produced from <code><nowiki>{{skill icon|Hammer (skill)}}</nowiki></code>
* {{skill icon|Hammer||Hammer (skill)}} is produced from <code><nowiki>{{skill icon|Hammer||Hammer (skill)}}</nowiki></code>
* {{skill icon|Manufacture}} is produced from <code><nowiki>{{skill icon|Manufacture}}</nowiki></code>
* {{skill icon|Manufacture}} is produced from <code><nowiki>{{skill icon|Manufacture}}</nowiki></code>




'''TODO''':  
'''TODO''':  
* Can file pages have (skill) in the name? I believe () normally isn't allowed in windows file naming.
** If so, I'd like to figure out how to exclude (skill) from the displayed article link (e.g. [[Hammer (skill)|Hammer]] or [[Hammer (skill)|Hammer]])
** <code><nowiki>[[{{{1}}}|]]</nowiki></code> doesn't seem to work via template code, but works in the above example. Also tried <code><nowiki>&#124;</nowiki></code> and <code><nowiki>{{!}}</nowiki></code>.
** Consider adding (skill) for all skill articles. <code><nowiki>[[{{{1}}} (skill)|{{{1}}}]]</nowiki></code>
* Add {{#if}} to include article link or only icon.
* Add {{#if}} to include article link or only icon.
** May not worry about this. Might be necessary to include article link each time a skill is referenced.  
** May not worry about this. Might be necessary to include article link each time a skill is referenced.  
* Import all skill icon image files (Skill Name icon.png)
** need to get export
** At least start with Teleport, Visit, Invite, Party Recall, and Revive as they are commonly referenced
</noinclude>
</noinclude>

Latest revision as of 19:23, 12 July 2024

Description

{{skill icon|<skill name>|<size>|<alternate page link>}}

Displays a link to the skill and adds a skill icon in front of it.

Parameters

1 (unnamed parameter)
Skill name.
2 (unnamed parameter)
Icon size. Options: "big" (48px), "huge" (100px), or, blank (32px) - which is the default size.
3 (unnamed parameter)
Alternate page link. Include if skill needs disambiguation from another page (e.g. the Paladin Hammer skill should not link to the Hammer item page).

Examples

  • Magic Defense is produced from {{skill icon|Magic Defense}}
  • Magic Defense is produced from {{skill icon|Magic Defense|big}}
  • Magic Defense is produced from {{skill icon|Magic Defense|huge}}
  • Revive is produced from {{skill icon|Revive}}
  • Teleport is produced from {{skill icon|Teleport}}
  • Visit is produced from {{skill icon|Visit}}
  • Invite is produced from {{skill icon|Invite}}
  • Party Recall is produced from {{skill icon|Party Recall}}
  • Hammer is produced from {{skill icon|Hammer||Hammer (skill)}}
  • Manufacture is produced from {{skill icon|Manufacture}}


TODO:

  • Add {{#if}} to include article link or only icon.
    • May not worry about this. Might be necessary to include article link each time a skill is referenced.