Last modified: 2012-01-26 15:27:34 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 16448 - Add {{DEFAULTSORT}} variable that returns the currently set defaultsort key
Add {{DEFAULTSORT}} variable that returns the currently set defaultsort key
Status: NEW
Product: MediaWiki
Classification: Unclassified
Templates (Other open bugs)
unspecified
All All
: Low enhancement with 3 votes (vote)
: ---
Assigned To: Nobody - You can work on this!
: parser
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-11-24 16:26 UTC by Purodha Blissenbach
Modified: 2012-01-26 15:27 UTC (History)
3 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Purodha Blissenbach 2008-11-24 16:26:04 UTC
Please add a constant {{DEFAULTSORT}}

It should just get the value that was set by
{{DEFAULTSORT:value}}, if any.

If {{DEFAULTSORT}} has been used, and the value is thus set,
it will be helpful to be able to use it inside templates,
e.g. so as to superceede a sort key that the template would be
using otherwise.
Comment 1 Purodha Blissenbach 2008-11-29 22:43:41 UTC
Adding some precision:

{{DEFAULTSORT:xyz}} - sets default sort key. We have that already.

New would be these:

{{DEFAULTSORT}} - renders nothing if no default sort key is set for the page.
{{DEFAULTSORT}} - yields the default sort key if one is set for the page.

{{DEFAULTSORT|xyzzy}} - renders "xyzzy" if no default sort key is set for the page.
{{DEFAULTSORT|zyx}} - yields the default sort key if one is set for the page.

The latter two resemble parameter references in templates, thus,
inside templates you can do something like:

[[category:foo|{{{bar | {{DEFAULTSORT | {{PAGENAME}} }} }}}]]

which may come handy.
Comment 2 m1shawhan@yahoo.com 2009-03-20 05:01:21 UTC
I am also running into the need for integration of the parameter references in the templates. If the possibility for the DEFAULTSORT to be utilized in or with parser functions it would also be extremely helpful. If nothing else, allow the [[category:foo|{{{bar | {{DEFAULTSORT | {{PAGENAME}} }} }}}]]. I'm fairly surprised this has taken this long to be addressed as the DEFAULTSORT key is used commonly in categorization.
Comment 3 Bawolff (Brian Wolff) 2011-09-11 02:13:22 UTC
I'm thinking something like this should perhaps be named something different than {{DEFAULTSORT}} to avoid confusion (and potentially open up the possibility of {{DEFAULTSORT:some other page}} syntax later if that's deemed useful), but can't come up with any good names ({{GETDEFAULTSORTKEY}} but nothing else uses get...). Maybe keeping the same name would be ok...
Comment 4 Bawolff (Brian Wolff) 2011-09-11 02:25:31 UTC
In r96767  (MediaWiki 1.19) I added a feature to defaultsortkey: {{DEFAULTSORTKEY:sortkey here|noreplace}} which will cause defaultsortkey to do nothing if a sortkey is already specified earlier in the page.

With that in mind, are there still use cases for a {{DEFAULTSORTKEY}} variable that would output what the last defaultsortkey set was?
Comment 5 Purodha Blissenbach 2012-01-26 15:27:34 UTC
At the moment, I do not have a compelling real life use case, but mileage may vary...

It might be useful inside templates, e.g. when referring to entries in sorted tables using the sort key:
[{{fullurl:...}}#{{DEFAULTSORTKEY}} list entry]

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links