I too, would like to know the answer to this!
Thread Starter
Matt
(@syntax53)
I tried to fix this myself today and I’m a little confused as it looks like you guys do it already, but it’s not working for whatever reason.
In inc.sort.php you have …
if(phpversion() < '5.4') array_multisort($rawnames, SORT_ASC, SORT_STRING, $links, $locs, $exts, $fulls, $dirs, $times, $dynamics);
else array_multisort($rawnames, SORT_ASC, SORT_NATURAL, $links, $locs, $exts, $fulls, $dirs, $times, $dynamics);
… and when I check the debug output of $rawnames they get sorted properly with SORT_NATURAL. However, the don’t end up displaying that way. At least not with the table view. If I do a list view with recursive=”on” it displays properly. But as soon as I do a table view (or directories=”on”, which seems to enforce table mode), the sorting is off again.
I was assuming the table is doing it’s own sorting after it’s drawn or something but I can’t find it.
Thanks
Thread Starter
Matt
(@syntax53)
So I figured it out and it’s a combination of two things. So #1) In inc.directories.php you are not sorting the directory listing (natural or otherwise). On line 47 you have:
foreach(glob("$dir"."/*", GLOB_ONLYDIR) as $k=> $folder)
and if I modify that and do this instead:
$dir_array = glob("$dir"."/*", GLOB_ONLYDIR);
if(phpversion() < '5.4') array_multisort($dir_array, SORT_ASC, SORT_STRING);
else array_multisort($dir_array, SORT_ASC, SORT_NATURAL);
foreach($dir_array as $k=> $folder)
and also add a ‘ sortfirst=”disabled” ‘ to the shortcode, the listing is then sorted properly. If I don’t disable the sorting then the javascript in footable.js screws up the sorting again.