Hello!
I was looking at this code http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/intersection/Dyna...
and trying to figure out how to change this piece of code ---- if ('lastedit' == $sOrderMethod) $sSqlWhere .= ' ORDER BY page_touched '; else $sSqlWhere .= ' ORDER BY c1.cl_timestamp ';
$sSqlWhere .= $sSqlOrder; ---- in such way that the extension could order the list alphabetically.
I imagine it would be a simple change, like this: ---- switch ($sOrderMethod) { case 'lastedit': $sSqlWhere .= ' ORDER BY page_touched '; break; case 'alphabetical': $sSqlWhere .= ' ORDER BY WHAT? '; break; case 'categoryadd': default: $sSqlWhere .= ' ORDER BY c1.cl_timestamp '; break; } ----
But I don't know what to use in the SQL instead of the "WHAT?". Does anybody knows what should it be?
Thanks in advance!
Helder
2009/9/5 Helder Geovane Gomes de Lima heldergeovane@gmail.com:
But I don't know what to use in the SQL instead of the "WHAT?". Does anybody knows what should it be?
You should probably use "ORDER BY page_namespace, page_title" there, which will sort by namespace, then by title.
Roan Kattouw (Catrope)
"Roan Kattouw" roan.kattouw@gmail.com wrote in message news:f154f3a80909050742i90f5949vf0fad7962a154935@mail.gmail.com...
2009/9/5 Helder Geovane Gomes de Lima heldergeovane@gmail.com:
But I don't know what to use in the SQL instead of the "WHAT?". Does anybody knows what should it be?
You should probably use "ORDER BY page_namespace, page_title" there, which will sort by namespace, then by title.
However, it should be noted that page_namespace is the numeric index for the namespace, NOT the textual representation of it, therefore in all languages they will be ordered as follows (with the namespace names being the appropriate ones for the language being used):
Foo Talk:Foo User:Foo User talk:Foo Project:Foo Project talk:Foo File:Foo.jpg File talk:Foo.jpg MediaWiki:Foo MediaWiki talk:Foo Template:Foo Template talk:Foo Help:Foo Help talk:Foo Category:Foo Category talk:Foo
Rather than the following 'properly alphabetical' order (assuming language=en):
Category talk:Foo Category:Foo File talk:Foo.jpg File:Foo.jpg Foo Help talk:Foo Help:Foo MediaWiki talk:Foo MediaWiki:Foo Project talk:Foo Project:Foo Talk:Foo Template talk:Foo Template:Foo User talk:Foo User:Foo
This is probably desirable, but I thought it worth pointing out...
- Mark Clements (HappyDog)
wikitech-l@lists.wikimedia.org