Controlling output order: Difference between revisions

Content added Content deleted
m (Alianin moved page DPL:Parameters: Controlling Output Order to Extension:DPL3/Parameters: Controlling output order without leaving a redirect: Changing namespaces.)
No edit summary
Line 1: Line 1:
{{DPL Manual|section=Parameters|subsection=Controlling Output Order}}
{{DPL manual|section=Parameters|subsection=Controlling output order}}


DPL allows you to define the sort order of its output as is explained below.
DPL3 allows you to define the sort order of its output as is explained below.


In some cases this is not sufficient, however. Think of the following example: You create a list of pages which use a certain template. You want to show the value of the first parameter each page uses when calling that template. This can easily be done with the [[include]] feature of DPL. If you now wanted the output to be sorted by the value of that parameter DPL could not help because it had to analyse all articles before finding those parameter values.
In some cases this is not sufficient, however. Think of the following example: You create a list of pages which use a certain template. You want to show the value of the first parameter each page uses when calling that template. This can easily be done with the [[include]] feature of DPL. If you now wanted the output to be sorted by the value of that parameter DPL could not help because it had to analyze all articles before finding those parameter values.


But there is another way: Create a ''sortable wiki table'' (using the [[table]] option of DPL with 'class=sortable') and you can click on the column headings to sort your output accordingly. However, the initial order shown in that table will still be the order in which DPL parsed the wiki pages (usually an alphabetic order of the page names).
But there is another way: Create a ''sortable wiki table'' (using the [[table]] option of DPL with 'class=sortable') and you can click on the column headings to sort your output accordingly. However, the initial order shown in that table will still be the order in which DPL parsed the wiki pages (usually an alphabetic order of the page names).
Line 21: Line 21:
if (cell.innerHTML.indexOf("sortheader") < 0) { ... place the original code line here ... }
if (cell.innerHTML.indexOf("sortheader") < 0) { ... place the original code line here ... }


==ordermethod==

__TOC__


===ordermethod===


{{DPL Parameter
{{DPL Parameter
Line 71: Line 67:
This list will output pages that have <nowiki>[[Category:Africa]]</nowiki> showing most recently edited articles at the top.
This list will output pages that have <nowiki>[[Category:Africa]]</nowiki> showing most recently edited articles at the top.


===order===
==order==


{{DPL Parameter
{{DPL Parameter
Line 100: Line 96:
In addition the edit date will be presented with each article.
In addition the edit date will be presented with each article.


==ordercollation==

===ordercollation===


{{DPL Parameter
{{DPL Parameter