Difference between revisions of "Template:List Locations/query template"

From Salem Wiki
Jump to: navigation, search
m (Added display of 'Unkown Item icon.png' when image not exist)
m (linkfix)
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
<onlyinclude><!--
 
<onlyinclude><!--
 
-->[[Image:{{
 
-->[[Image:{{
#ifexist: Image:{{#replace:{{{1|Terrain#Grassland}}}|#|_}}.png
+
#ifexist: Image:{{#replace:{{{1|Terrain/Plains/Grassland}}}|/|_}}.png
| {{#replace:{{{1|Terrain#Grassland}}}|#|_}}.png<!--
+
| {{#replace:{{{1|Terrain/Plains/Grassland}}}|/|_}}.png<!--
 
-->{{!}}30px<!--
 
-->{{!}}30px<!--
-->{{!}}link={{{1|Terrain#Grassland}}}<!--
+
-->{{!}}link={{{1|Terrain/Plains/Grassland}}}<!--
-->{{!}}{{#explode:{{{1|Terrain#Grassland}}}|#|-1}}
+
-->{{!}}{{#explode:{{{1|Terrain/Plains/Grassland}}}|/|-1}}
 
| Unknown Item icon.png<!--
 
| Unknown Item icon.png<!--
-->{{!}}link={{{1|Terrain#Grassland}}}<!--
+
-->{{!}}link=Image:{{#replace:{{{1|Terrain/Plains/Grassland}}}|/|_}}.png<!--
 
-->{{!}}No image found, click to upload
 
-->{{!}}No image found, click to upload
 
}}<!--
 
}}<!--
 
-->]] <!--
 
-->]] <!--
-->[[{{{1|Terrain#Grassland}}} | {{#explode:{{{1|Terrain#Grassland}}}|#|-1}}]].<!--
+
-->[[{{{1|Terrain/Plains/Grassland}}} | {{#explode:{{{1|Terrain/Plains/Grassland}}}|/|-1}}]].<!--
 
--></onlyinclude><noinclude>{{documentation}}</noinclude>
 
--></onlyinclude><noinclude>{{documentation}}</noinclude>

Latest revision as of 08:22, 29 July 2012

Grassland Grassland.

Template documentation (for the template shown above, sometimes hidden or invisible)

Description

This template is used to format the output-results of the SMW-Query used in {{List Locations}}.
It expects one un-named parameter consisting of a link to a subpage of a page, eg: Terrain/Grassland.
To compose the filename of the image to show it replaces the '/' with an '_', in the parameter-value, followed by '.png'.
When the image is displayed, it will link to the original parameter-value, and re-sized to 30px width.
If no image exist by that name then Unknown Item icon.png will be shown and linked to the image-file with the composed filename.
See Inline queries to see how an inline query can use this to format the display of query results.