Difference between revisions of "Template:Display image"

From Wikispooks
Jump to navigation Jump to search
(recode)
(check the file exists)
 
(8 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
<noinclude>[[category:Semantic Utility Templates]]'''This is a semantic utility template to allocate [[Property:Display image]].'''<br/>
 
<noinclude>[[category:Semantic Utility Templates]]'''This is a semantic utility template to allocate [[Property:Display image]].'''<br/>
 +
It may call the other templates [[Template:Display image/image]] and [[Template:Display class icon]].<br/>
 
The logic is as follows:<br>
 
The logic is as follows:<br>
*'' If the page [[Property:Has logo|Has logo]], and that file exists, then use that.
+
*'' If the page [[Property:Has logo2|Has logo2]], and that file exists, then use that.
*'' Elseif the page [[Property:Has image|Has image]], and that file exists, then use that.
+
*'' Elseif the page [[Property:Has image2|Has image2]], and that file exists, then use that.
 
*'' Else use an icon derived from the page's [[Property:Has objectClass2|Has objectClass2]].
 
*'' Else use an icon derived from the page's [[Property:Has objectClass2|Has objectClass2]].
  
 
Usage:
 
Usage:
 
  <nowiki>{{</nowiki>{{PAGENAME}}|''Pagename''<nowiki>}}</nowiki></noinclude><includeonly>{{#if: {{{1|}}}|
 
  <nowiki>{{</nowiki>{{PAGENAME}}|''Pagename''<nowiki>}}</nowiki></noinclude><includeonly>{{#if: {{{1|}}}|
{{#switch: {{{2|}}}
+
{{#ifexpr: {{#ask:[[-Has logo::{{{1}}}]]|format=count}}>0|{{#ifexist: {{#show: {{{1}}}|?Has logo2}}|{{#show: {{{1}}} |?Has logo2}}|{{Display image/image|{{{1|}}}}}}}|{{Display image/image|{{{1|}}}|}}}}}}</includeonly>
|case = logo
 
{{#ifexpr: {{#ask:[[-Has logo::{{{1}}}]]|format=count}}>0|haslogo|{{Display image|{{{1|}}}|image}}}}
 
|case = image
 
{{#ifexpr: {{#ask:[[-Has image::{{{1}}}]]|format=count}}>0|hasimage|{{Display image|{{{1|}}}|image}}}}
 
|case = class
 
{{#ask:[[-Has objectClass2::{{{1}}}]]}}.png
 
|default {{Display image|{{{1|}}}|logo}}
 
}}}}
 

Latest revision as of 15:00, 15 July 2015

This is a semantic utility template to allocate Property:Display image.
It may call the other templates Template:Display image/image and Template:Display class icon.
The logic is as follows:

  • If the page Has logo2, and that file exists, then use that.
  • Elseif the page Has image2, and that file exists, then use that.
  • Else use an icon derived from the page's Has objectClass2.

Usage:

{{Display image|Pagename}}