Template:Img item/doc: Difference between revisions
No edit summary |
(updated to include latest parameters, and details) |
||
Line 1: | Line 1: | ||
<noinclude>{{Documentation subpage}}</noinclude> | <noinclude>{{Documentation subpage}}</noinclude> | ||
The {{tlx|img_item}} template is used to generate an item image by simply knowing the display name or item ID. | The {{tlx|img_item}} template is used to generate an item image by simply knowing the display name or item ID. | ||
==Editing== | ==Editing== | ||
Line 10: | Line 10: | ||
==Usage== | ==Usage== | ||
<pre>{{img_item | <pre>{{img_item | ||
|item = | |item = <!-- or {{{1}}} (first anonymous parameter) --> | ||
|size = | |size = <!-- optional --> | ||
|icon = <!-- or |img = --> <!-- optional --> | |||
|link = <!-- optional --> | |||
|name = <!-- optional --> | |||
}}</pre> | }}</pre> | ||
{{img_item | {{img_item}} | ||
==Parameters== | ==Parameters== | ||
;item: Determines the item image, name and link. Can be the item's display name, | ;item: Determines the item image, name and link. Can be the item's display name, item ID (without module) or previous names (so long as there are no conflicts). Can be replaced with the first [[#Anonymous parameters|anonymous parameter]]. ''Default: [[:File:image.png]]'' | ||
;size: The size of | ;size: The size of the image. This can be left blank unless needed to be customised. ''Default: 32px'' | ||
;icon: Manually set the image to be displayed. | ;icon: Manually set the image to be displayed. This will normally be left blank. Can be replaced with '''img'''. | ||
;link: Manually set the link for the image. | ;link: Manually set the link for the image. This will normally be left blank. | ||
;name: Manually set the "name" to show when hovering over. | ;name: Manually set the "name" to show when hovering over. This will normally be left blank. | ||
===Anonymous parameters=== | |||
{{see|https://www.mediawiki.org/wiki/Help:Templates#Anonymous_parameters Anonymous parameters}} | |||
;{{{1}}}: Alternative to '''item''', for simplified markup. Determines the item image, name and link. Can be the item's display name, item ID (without module) or previous names (so long as there are no conflicts). ''Default: [[:File:image.png]]'' | |||
;{{{2}}}: Adding "name" will remove the image and only display the name and link. Alternative to using {{tlx|Img_item/link}} and {{tlx|Img_item/name}}. | |||
==Examples== | ==Examples== | ||
{| class="wikitable" | |||
!Type | |||
< | !Produces | ||
!Explanation | |||
{{img_item|item=ShotgunShellsBox|size=32px}} | |- | ||
|<pre>{{img_item|item=ShotgunShellsBox|size=32px}}</pre> | |||
|{{img_item|item=ShotgunShellsBox|size=32px}} | |||
Using the | |Using the item ID with the '''item''' and '''size''' parameters. | ||
< | |- | ||
|<pre>{{img_item|ShotgunShellsBox}}</pre> | |||
{{img_item| | |{{img_item|ShotgunShellsBox}} | ||
|The markup can be simplified by removing the '''item''' and '''size''' parameters, and just including the item ID as the first [[#Anonymous parameters|anonymous parameter]]. This produces the same result as the above example. | |||
|- | |||
|<pre>{{img_item|icon=Chainsaw_Model|size=64px|name=Zombie slayer|link=Zombie}}</pre> | |||
|{{img_item|icon=Chainsaw_Model|size=64px|name=Zombie slayer|link=Zombie}} | |||
|The '''icon''', '''size''', '''name''' and '''link''' can be manually adjusted. Here it's showing the [[Chainsaw]] model as the '''icon''' at '''size''' 64px, "Zombie slayer" as the '''name''', and [[Zombies]] as the '''link'''. | |||
|- | |||
|<pre>{{img_item|ShotgunShellsBox|name}}</pre> | |||
|{{img_item|ShotgunShellsBox|name}} | |||
|Using just the '''first''' and '''second''' [[#Anonymous parameters|anonymous parameters]], with the '''second''' being "name", display just the indexed name and link. | |||
|- | |||
|} |
Revision as of 12:51, 21 April 2022
This is a documentation subpage for Template:Img item.
It contains usage information and other content that is not part of the original template page. |
The {{img_item}}
template is used to generate an item image by simply knowing the display name or item ID.
Editing
To add new definitions or edit an existing one, please go to the following subpages:
- Img_item/icon - for the icon
- Img_item/link - for the link
- Img_item/name - for the name
Usage
{{img_item |item = <!-- or {{{1}}} (first anonymous parameter) --> |size = <!-- optional --> |icon = <!-- or |img = --> <!-- optional --> |link = <!-- optional --> |name = <!-- optional --> }}
Parameters
- item
- Determines the item image, name and link. Can be the item's display name, item ID (without module) or previous names (so long as there are no conflicts). Can be replaced with the first anonymous parameter. Default: File:image.png
- size
- The size of the image. This can be left blank unless needed to be customised. Default: 32px
- icon
- Manually set the image to be displayed. This will normally be left blank. Can be replaced with img.
- link
- Manually set the link for the image. This will normally be left blank.
- name
- Manually set the "name" to show when hovering over. This will normally be left blank.
Anonymous parameters
- See more: [Anonymous parameters]
- {{{1}}}
- Alternative to item, for simplified markup. Determines the item image, name and link. Can be the item's display name, item ID (without module) or previous names (so long as there are no conflicts). Default: File:image.png
- {{{2}}}
- Adding "name" will remove the image and only display the name and link. Alternative to using
{{Img_item/link}}
and{{Img_item/name}}
.
Examples
Type | Produces | Explanation |
---|---|---|
{{img_item|item=ShotgunShellsBox|size=32px}} |
Using the item ID with the item and size parameters. | |
{{img_item|ShotgunShellsBox}} |
The markup can be simplified by removing the item and size parameters, and just including the item ID as the first anonymous parameter. This produces the same result as the above example. | |
{{img_item|icon=Chainsaw_Model|size=64px|name=Zombie slayer|link=Zombie}} |
The icon, size, name and link can be manually adjusted. Here it's showing the Chainsaw model as the icon at size 64px, "Zombie slayer" as the name, and Zombie as the link. | |
{{img_item|ShotgunShellsBox|name}} |
Box of Shotgun Shells | Using just the first and second anonymous parameters, with the second being "name", display just the indexed name and link. |