Difference between revisions of "Template:Icon link"

From Mine Blocks Wiki
Jump to navigation Jump to search
If you find a typo, inconsistency, or error, please sign up and help out the wiki! We can't do it without your help! :D Thank you!

(It makes more sense to use an atlas image and then change background positions to display the icons' images, because with the previous method it would make houndreds of http requests to load all images and that's a big no no for everyone. Also, making it a switch case with predefined values so it's as easy as before to use.)
Line 1: Line 1:
{{#if: {{{1|}}}|[[{{{1}}}|<span class="icon-link">{{#switch: {{{1}}}
+
{{#if: {{{1|}}}|[[{{{1}}}{{!}}<span class="icon-link">{{#switch: {{{1}}}
| Wooden Planks = <span class="sprite-icon pixel" style="background-position: 0 -128px;"><span class="sprite-text">{{{1}}}</span>]]
+
{{!}} Wooden Planks = <span class="sprite-icon pixel" style="background-position: 0 -128px;"><span class="sprite-text">{{{1}}}</span>]]
<!--| = <span class="sprite-icon pixel" style="background-position": ;><span class="sprite-text">{{{1}}}</span>]]-->
+
<!--{{!}} = <span class="sprite-icon pixel" style="background-position": ;><span class="sprite-text">{{{1}}}</span>]]-->
 
}}</span>}}<noinclude>
 
}}</span>}}<noinclude>
 
== About ==
 
== About ==

Revision as of 12:32, 23 December 2021

{{#if: |[[{{{1}}}|}}

About

This template (named Ilink as a shortcut for icon link) serves as an easy method to add icon sprites along with their link into a page or anywhere else using a single, standarized format.

Usage

The syntax of the template is {{Ilink|<name>|<link>|<displayed-name>?|<tooltip-text>?|<class>?}}</nowiki>. All parameters default to the first one if those are not specified.

Examples

  • {{Ilink|Wooden Planks}}</nowiki> → {{#if: Wooden Planks|[[Wooden Planks|}}