Difference between revisions of "Template:DisplayAverageRating"

From Wikispooks
Jump to navigation Jump to search
(fix for 1 rating)
 
(2 intermediate revisions by the same user not shown)
Line 2: Line 2:
 
{{#switch: {{#ask: [[Constitutes::Rating]][[Has target::{{FULLPAGENAME}}]]|format=count}}
 
{{#switch: {{#ask: [[Constitutes::Rating]][[Has target::{{FULLPAGENAME}}]]|format=count}}
 
  | 0 =<!-- 1 or more, display average rating -->
 
  | 0 =<!-- 1 or more, display average rating -->
  | #default = '''Average Rating''': [[image:{{#show: {{FULLPAGENAME}} | ?Has averageRating }}star.png|100px|link=#Ratings|alt={{#show: {{FULLPAGENAME}} | ?Has averageRating }}]] {{#show: {{FULLPAGENAME}} | ?Has averageRating }} from {{#ask: [[Constitutes::Rating]][[Has target::{{FULLPAGENAME}}]]|format=count}} reviews}}</includeonly>
+
  | #default =[[image:{{#show: {{FULLPAGENAME}} | ?Has averageRating }}star.png|100px|link=Rating|alt={{#show: {{FULLPAGENAME}} | ?Has averageRating }}]]<!-- Simpler not to
 +
{{#show: {{FULLPAGENAME}} | ?Has averageRating }}-->{{#ifeq: {{#ask: [[Constitutes::Rating]][[Has target::{{FULLPAGENAME}}]]|format=count}}|1|| from {{#ask: [[Constitutes::Rating]][[Has target::{{FULLPAGENAME}}]]|format=count}} reviews}}}}</includeonly>

Latest revision as of 15:38, 1 November 2017

This is intended for use on pages at the top of an infobox. It displays the average rating of that page, and links to the ratings section.