Difference between revisions of "Issue:Conditional clause in output?"
From FollowTheScore
(New page: {{Issue |Type = Change Request <-- please select |Extension = DPL |Version = 1.8.6 |Description = |Status = open }} == Problem == Hi, I want to use an conditiona...) |
|||
Line 15: | Line 15: | ||
*Bob Ross.gif is used two articles. | *Bob Ross.gif is used two articles. | ||
*Placeholder.png is not used on any page. | *Placeholder.png is not used on any page. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
{{User:Subfader/Examples/Images used}} | {{User:Subfader/Examples/Images used}} | ||
Line 48: | Line 41: | ||
}} | }} | ||
</pre> | </pre> | ||
+ | |||
+ | |||
+ | '''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 = "X pages link to this image" (if it's expensive then X = Multiple is ok too) | ||
+ | *If the image is unused: Gallery text = "This image is unused." | ||
== Reply == | == Reply == |
Revision as of 17:02, 5 July 2009
Description: | |
Extension / Version: | DPL / 1.8.6 |
Type / Status: | Change Request <-- please select / 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 image pages 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.
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 = "X pages link to this image" (if it's expensive then X = Multiple is ok too)
- If the image is unused: Gallery text = "This image is unused."