2015-08-08, 06:05:51
(2015-08-08, 05:43:55)moonspider Wrote: I have a simple question, pretty sure there's got to be an answer for that.
I use return_i18n_search_results in my template for various lists. My pages also have numeric slugs, e.g. 01,02,03, etc.
Being a PHP noob that I am, at first I named everything straightforward with 1,2,3. But then came page 10 and all my search lists reavealed that 10 comes after 1 and not 9. I fixed the problem temporarily by adding a zero to the first 9 pages, but that's only until I get to page 100
In short, if I use 'reverseurl' and 'url' as $order, is there a way to sort the results in natural order so that 10 comes after 9 etc?
Not tested: looking at the code it might work if you use 'id' or '-id' as order instead - the url/slug is stored in the id field and when comparing numeric strings, it should sort them numerically.