Difference between revisions of "Issue:Request For %TOTALPAGES% Token"
Line 4: | Line 4: | ||
|Version = 1.6.2 | |Version = 1.6.2 | ||
|Description = Token that represents the total number of pages that match the DPL criteria. | |Description = Token that represents the total number of pages that match the DPL criteria. | ||
− | |Status = | + | |Status = closed |
}} | }} | ||
Line 25: | Line 25: | ||
[[User:Gero|Gero]] 21:47, 6 December 2007 (CET) | [[User:Gero|Gero]] 21:47, 6 December 2007 (CET) | ||
+ | |||
+ | : Haven browsed through the DPL2 code and seeing the SQL statements used, I have to admit, the impracticality of implementing this outweighs its usefulness. I withdraw my primary request (but I still maintain the secondary one). —[[User:Sledged|Sledged]] ([[User talk:Sledged|talk]]) 23:01, 6 December 2007 (CET) |
Latest revision as of 23:01, 6 December 2007
Description: | Token that represents the total number of pages that match the DPL criteria. |
Extension / Version: | DPL / 1.6.2 |
Type / Status: | Change Request / closed |
Problem
Since there is a limit on the number of pages returned, the token %PAGES% is never more than ExtDynamicPageList2::$maxResultCount, and there's no readily available mechanism for finding exactly how many pages exist that match the search criteria. I suggest adding the token %TOTALPAGES% to represent this value. Also, the %PAGES% token should be available in parameters other than the resultsheader and resultsfooter parameters. There's been times I've wanted to have output like:
1 of 26 2 of 26 ... 26 of 26
—Sledged (talk) 04:50, 6 December 2007 (CET)
Reply
This is much harder to do than you might think. Only after all template matches (see includematch) have been evaluated we know the exact number of matches. This means that we would have to make an unlimited query just to get the correct number. A simple count(*) would not do (apart from the fact that the count(*) would require a SQL query for itself).
I recommend to write TWO DPL queries where the first one has an empty format clause. IN this DPL query the value of %PAGES% can be assigned to a local variable with #vardefine in the 'resultsfooter' clause. This variable can then be used in the second query at any place ... I know it´s not ideal but it should work.
Gero 21:47, 6 December 2007 (CET)