Forum:Sorting template

Hello, I created this template to controlling the sorting of progressive files and pages in a category, especially to avoid that "Page 10" will be sorted before "Page 2". I used the DEFAULTSORT magic word, but I cannot understand why it's not working properly since if you try to see what sorting keys is used, there shouldn't be any problem.


 * I see two problems with it.


 * The first part is that you apply the template to files, more specifically because the pagename of these files has an extension. The template takes the second piece of the pagename, and pads it to a maximum length of 4 digits. So a "2" becomes "0002", a "23" becomes a "0023" etc. With the files however, the second piece of the pagename looks like "2.jpg" and "23.jpg". That's longer than 4 digits already, so it doesn't pad it.


 * The second problem has to do with the caching of categories... It seems that the last page you edit is affecting the order of sorting. So the category gets messed up no matter what you do.


 * -- 19:01, August 4, 2012 (UTC)


 * I should have corrected the first problem, but I did not understand what the second one is about...


 * The second one sorts the pages differently every time you save the page (at least in the tests I did). If you save a 23 page and then a 45 page, the pages might be sorted correctly (23 then 45). If you then save one of the pages again, their order might change (45 will be on top of 23). It's a pretty weird behaviour. -- 10:20, August 5, 2012 (UTC)