Controlling output order: Difference between revisions

m
Add a category sortkey, so these can be displayed in the correct order on the parameter quick reference page. I still need to go through this page (when I'm finished the others that are more complex) and do all the examples, plus more content fixes.
imported>FrozenPlum
mNo edit summary
imported>FrozenPlum
m (Add a category sortkey, so these can be displayed in the correct order on the parameter quick reference page. I still need to go through this page (when I'm finished the others that are more complex) and do all the examples, plus more content fixes.)
Line 8:
But there is another way: Create a ''sortable wiki table'' (using the {{DPL|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).
 
Using a handful of javascriptJavaScript lines, you can sort a wikitable ''on pageLoad'' by any column. You must insert that javascriptJavaScript code AT THE END of your page :
 
sortables_init();
Line 19:
ts_resortTable(lnk);
 
Prior toBefore version 1.16 of MediaWiki, ''wikibits.js'' was typically called at the end of a page and performed ''sortables_init()''. Calling it explicitly did not result in it being recognized, but rather resulted in adding a second set of sort link buttons.
 
 
Line 81:
 
 
'''Syntax:''' <brcode>order=<i>orderdirection</i></code>
 
<code>order=<i>orderdirection</i></code>
 
''orderdirection'' can be one of:
Line 91 ⟶ 89:
 
If combined with <code>{{DPL|ordermethod}}</code>, the <code>''ascending''</code> and <code>''descending''</code> values can control the sort direction of some ordermethod values, such as <code>ordermethod=''title''</code>.
 
 
'''Example:'''
 
* ''descending'' &mdash; outputs list from most recent to least recent
* ''ascending'' &mdash; outputs list from least recent to most recent — '''(default)'''
 
 
<pre><nowiki>
'''Example:'''
<pre>
{{#dpl:
|category = Africa
Line 105 ⟶ 102:
|addeditdate = true
}}
</nowiki></pre>
 
This list will outputlist pages that have <nowiki>[[Category:Africa]]</nowiki> shown, ordered from oldest to newest.
In addition, the edit date will be presented with each article.
 
Line 115 ⟶ 112:
{{DPL Parameter
|name = ordercollation
|purpose= AllowDefines the collating sequence for ordering. Allows individual collations, makemakes case-insensitive sorting possible.
}}
 
defines the collating sequence for ordering.
 
Note: A very special (proprietory) function can be used to sort card suit symbols according to the rank of suits that is used in the card game of bridge (this cannot be done by standard collating sequences). To trigger this function, set <code>ordercollation=bridge</code>.
 
 
'''Example:'''<br>
 
<code>ordercollation=<i>latin1_german_ci</i></code>
 
'''Syntax:''' <code>ordercollation=<i>latin1_german_ci</i></code>
You may want to try <code>latin1_swedish_ci</code> or other collation mapping table names as well.
 
If you use a name for the first time, you should make sure that it is spelled correctly. Otherwise, you will see a SQL error message.
 
'''Notes:'''
* For case insensitivity during the ''selection'' of articles, see {{DPL|ignorecase}}.
* You may want to try <code>latin1_swedish_ci</code> or other collation mapping table names as well. If you use a name for the first time, you should make sure that it is spelled correctly. Otherwise, you will see a SQL error message.
Note:* A very special (proprietoryproprietary) function can be used to sort card suit symbols according to the rank of suits that is used in the card game of bridge (this cannot be done by standard collating sequences). To trigger this function, set <code>ordercollation=bridge</code>.
 
==References==
<references />
[[Category:Primary Module|03]]
Anonymous user