Template:Item icon: Difference between revisions
(more examples) |
(Update: use pagename directly, escape ' but not ") |
||
Line 2: | Line 2: | ||
tables=item_icon | tables=item_icon | ||
|fields=TRIM(icon),CONCAT('', '{{{size|40}}}') | |fields=TRIM(icon),CONCAT('', '{{{size|40}}}') | ||
|where=item_icon. | |where=item_icon._pageName="{{{name}}}" | ||
|limit=1 | |limit=1 | ||
|order by=item_icon.name | |order by=item_icon.name | ||
Line 38: | Line 38: | ||
<code><nowiki>{{ItemIcon|name=Potion of Healing|size=24|show_name=true}}</nowiki></code> {{ItemIcon|name=Potion of Healing|size=24|show_name=true}} | <code><nowiki>{{ItemIcon|name=Potion of Healing|size=24|show_name=true}}</nowiki></code> {{ItemIcon|name=Potion of Healing|size=24|show_name=true}} | ||
<code><nowiki>{{ItemIcon|name=The Red Knight's Final Stratagem}} (testing that pages with ' work)</nowiki></code> {{ItemIcon|name=The Red Knight's Final Stratagem}} | |||
</noinclude> | </noinclude> |
Revision as of 08:32, 5 September 2023
This template defines the table "item_icon". View table.
This template fetches an icon for an item using Cargo. It also declares the Cargo table for the "item_icon" table that stores this information. The information is uploaded using the standard item descriptions.
Usage:{{ItemIcon |name=the name of the icon page |size=(optional) the size of the icon |show_name=(optional) Whether to show the name. Any value will show the name of the item as a link. Omit to hide it. }}
Templates
Copy-ready template (no item name): {{ItemIcon|name=}}
Copy-ready template (with item name): {{ItemIcon|name=|show_name=true}}
Examples
{{ItemIcon|name=Potion of Healing}}
Function: CargoSQLQuery::run Query: SELECT `cargo__item_icon`.`_pageID` AS `cargo_backlink_page_id_item_icon`,TRIM(icon),CONCAT(, '40') FROM `cargo__item_icon` WHERE `cargo__item_icon`.`_pageName`="Potion of Healing" ORDER BY `cargo__item_icon`.`name` LIMIT 100
{{ItemIcon|name=Potion of Healing|size=30}}
Function: CargoSQLQuery::run Query: SELECT `cargo__item_icon`.`_pageID` AS `cargo_backlink_page_id_item_icon`,TRIM(icon),CONCAT(, '30') FROM `cargo__item_icon` WHERE `cargo__item_icon`.`_pageName`="Potion of Healing" ORDER BY `cargo__item_icon`.`name` LIMIT 100
{{ItemIcon|name=Potion of Healing|size=24|show_name=true}}
Function: CargoSQLQuery::run Query: SELECT `cargo__item_icon`.`_pageID` AS `cargo_backlink_page_id_item_icon`,TRIM(icon),CONCAT(, '24') FROM `cargo__item_icon` WHERE `cargo__item_icon`.`_pageName`="Potion of Healing" ORDER BY `cargo__item_icon`.`name` LIMIT 100
{{ItemIcon|name=The Red Knight's Final Stratagem}} (testing that pages with ' work)
Function: CargoSQLQuery::run Query: SELECT `cargo__item_icon`.`_pageID` AS `cargo_backlink_page_id_item_icon`,TRIM(icon),CONCAT(, '40') FROM `cargo__item_icon` WHERE `cargo__item_icon`.`_pageName`="The Red Knight's Final Stratagem" ORDER BY `cargo__item_icon`.`name` LIMIT 100