Difference between revisions of "Template:Display image"

From Wikispooks
Jump to navigation Jump to search
(stub)
Line 8: Line 8:
 
  <nowiki>{{</nowiki>{{PAGENAME}}|''Pagename''<nowiki>}}</nowiki></noinclude><includeonly>{{#if: {{{1|}}}|
 
  <nowiki>{{</nowiki>{{PAGENAME}}|''Pagename''<nowiki>}}</nowiki></noinclude><includeonly>{{#if: {{{1|}}}|
 
{{#switch: {{{2|}}}
 
{{#switch: {{{2|}}}
|case = logo
 
{{#ifexpr: {{#ask:[[-Has logo::{{{1}}}]]|format=count}}>0|haslogo|{{Display image|{{{1|}}}|image}}}}
 
 
|case = image
 
|case = image
 
{{#ifexpr: {{#ask:[[-Has image::{{{1}}}]]|format=count}}>0|hasimage|{{Display image|{{{1|}}}|class}}}}
 
{{#ifexpr: {{#ask:[[-Has image::{{{1}}}]]|format=count}}>0|hasimage|{{Display image|{{{1|}}}|class}}}}
 
|case = class
 
|case = class
 
{{#ask:[[-Has objectClass2::{{{1}}}]]}}.png
 
{{#ask:[[-Has objectClass2::{{{1}}}]]}}.png
|default {{Display image|{{{1|}}}|logo}}
+
|default  
 +
{{#ifexpr: {{#ask:[[-Has logo::{{{1}}}]]|format=count}}>0|haslogo|{{Display image|{{{1|}}}|image}}}}
 
}}}}
 
}}}}

Revision as of 17:00, 13 July 2015

This is a semantic utility template to allocate Property:Display image.
The logic is as follows:

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

Usage:

{{Display image|Pagename}}