Issue:Conditional clause in output?

From FollowTheScore
Revision as of 18:13, 5 July 2009 by Subfader (talk | contribs)
Jump to: navigation, search
Description:
Extension / Version: DPL   /   1.8.6
Type / Status: Change Request   /   open

Problem

Hi, I want to use an conditional clause in the output. The output should be different if there is no result, one result or multiple results. Example:

This calls images in Category:Test Images. It can later be used on category pages using category = PAGENAME. E.g. I Have disabled the Media section on Category pages cos the navigation sucks.
Atm it returns a gallery where the image links to its desc page and a list of links to the pages that use that image.

  • Cookie.jpg is only used on one article only.
  • Bob Ross.gif is used two articles.
  • Placeholder.png is not used on any page.
There are 4 images in Category:Test Images.


How it works:

{{#dpl:
|category=Test Images
|namespace=Image
|ordermethod=firstedit
|order=descending
|count=10
|resultsheader=<h2>Images</h2>There are %TOTALPAGES% images in this category.
|format=«gallery»\n,\n%PAGE%¦²{User:Subfader/Examples/Images used/Template¦%PAGE%}²,,\n«/gallery»
}}

The template to generate the article links =

{{#dpl:
|debug=0
|namespace=
|imageused={{{1}}}
|count=2
|format=,[[%PAGE%]]<br>,,
}}


Now the plan is:

  • If the image is only used on page: Gallery text = Link to the page that uses the image (standard case for my usage)
  • If the image is used on more than one page: Gallery text = [[:File:%PAGE%#filelinks|X pages link to this image]] (if counting the page links is expensive then "Multiple" is ok too)
  • If the image is unused: Gallery text = "This image is unused."


Reply