Template:ItemCard: Difference between revisions
Jump to navigation
Jump to search
Content added Content deleted
mNo edit summary |
(itemdata caching) |
||
Line 1: | Line 1: | ||
<includeonly>{{#ifeq: {{{2|}}} | block | {{#vardefine:block_output | true }} }}{{#ifeq: {{{3|}}} | block | {{#vardefine:block_output | true }} }}{{#ifeq: {{{4|}}} | block | {{#vardefine:block_output | true }} }}{{#ifeq: {{{5|}}} | block | {{#vardefine:block_output | true }} }}{{#vardefine: |
<includeonly>{{#ifeq: {{{2|}}} | block | {{#vardefine:block_output | true }} }}{{#ifeq: {{{3|}}} | block | {{#vardefine:block_output | true }} }}{{#ifeq: {{{4|}}} | block | {{#vardefine:block_output | true }} }}{{#ifeq: {{{5|}}} | block | {{#vardefine:block_output | true }} }}{{#if: {{#var:itemdata_{{{1|}}}}} || {{#vardefine:itemdata_{{{1|}}} | {{#cargo_query: |
||
tables=items |
tables=items |
||
|fields= CONCAT(Icon, '{{!}}', NameEN, '{{!}}', _pageName)=Item |
|fields= CONCAT(Icon, '{{!}}', NameEN, '{{!}}', _pageName)=Item |
||
Line 10: | Line 10: | ||
|format=list |
|format=list |
||
|no html |
|no html |
||
}} }}{{#vardefine:Icon | {{#explode:{{#var: |
}} }} }}{{#vardefine:Icon | {{#explode:{{#var:itemdata_{{{1|}}}}}|{{!}}|0}} }}{{#vardefine:Name | {{#explode:{{#var:itemdata_{{{1|}}}}}|{{!}}|1}} }}{{#vardefine:Page | {{#explode:{{#var:itemdata_{{{1|}}}}}|{{!}}|2}} }}{{#ifeq:{{{text|+}}}|{{{text|-}}} | {{#vardefine:DisplayName | {{{text|}}} }} | {{#vardefine:DisplayName | {{#var:Name}} }} }}{{#if: {{#var:block_output}} | <span style="display:inline-block;text-align:center;width:{{{2|32px}}}"> }}{{#if: {{{quantity|}}} | <span class="item-quantity">{{#ifexpr: {{{quantity|}}} < 10000 | {{{quantity|}}} | {{#ifexpr: {{{quantity|}}} < 1000000 | {{#expr: {{{quantity|}}}/1000 round 0 }}k | {{#expr: {{{quantity|}}}/1000000 round 1 }}M }} }}</span> }}[[File:{{#var:Icon}}|{{{2|32px}}}|{{#if: {{#var:DisplayName}} | {{#var:DisplayName}} | {{#var:Name}} }}|link={{#var:Page}}|class=itemcard]]{{#if: {{#var:DisplayName}} | [[{{#var:Page}}|{{#var:DisplayName}}]] }}{{#if: {{#var:block_output}} | </span> }}{{#vardefine:block_output | }}{{#vardefine:Name | }}{{#vardefine:Icon | }}{{#vardefine:Page | }}{{#vardefine:DisplayName | }}</includeonly><noinclude> |
||
Outputs an image of the item that links back to its page. |
Outputs an image of the item that links back to its page. |
||
==Usage== |
==Usage== |
Revision as of 04:47, 28 June 2022
Outputs an image of the item that links back to its page.
Usage
{{ItemCard|Name[|32px[|text=AltName][|block]][|quantity=1]}}
Options
32px
: image size with statement format corresponding to MediaWiki File size style (32px for set width, x32px for set height, 32x32px for arbitrary scaling); should be a width only value if usingblock
outputtext
: alternative item name to display. Usetext=
to disable text output entirelyquantity
: EXPERIMENTAL prefix the item icon with a quantity, intended for inline use with default sizeblock
: display card as a block element the width of the icon, with item name underneath