Support Home Page › Forums › Joomla Software › Easy Folder Listing Module › sort numbers stored as text. › Re: sort numbers stored as text.
January 16, 2012 at 11:29 pm
#1408
Michael Gilkes
Keymaster
@rgfuller. Thanks for your question. It is a good one. I haven’t tested this, but please try it and let me know. All you have to do is to change the contents of the compareName function in easyfolderlistingpro.php.
You should find this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
static function compareName($x, $y)<br /> {<br /> if ($x['name'] == $y['name'])<br /> {<br /> return 0;<br /> }<br /> elseif ($x['name'] < $y['name'])<br /> {<br /> return -1;<br /> }<br /> else<br /> {<br /> return 1;<br /> }<br /> } |
Change it to:
1 2 3 4 |
static function compareName($x, $y)<br /> {<br /> return strnatcmp($x['name'], $y['name']);<br /> } |
Let me know if it works.