We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 24100
    • 35 Posts
    How can I set the sorting order of files and folders appearing in the Resources > Manage Files area? I want to have them listed alpha-numerically in ascending order.


    Thanks!


    [EDIT] Well, forgive me for possibly breaking a rule by editing the manager, but I want the files to always display alpha-numerically and being new to linux I didn’t know if this gets ’set’ on the server or should be handled here in the code. So, I fixed this ’problem’ by editing the files.dynamic.php file in manager > actions directory and adding sort() functions just prior to the arrays being displayed:

    	// dump array entries for directories
    	$folders = count($dirs_array);
    	sort($dirs_array); // sorting the array alphabetically
    


    	// dump array entries for files
    	$files = count($files_array);
    	sort($files_array); // sorting the array alphabetically
    
      • 19004
      • 33 Posts
      Not to be a sour puss about this, but shouldn’t that either be the default behavior or at least configurable from within the manager? The fact that code must be edited to achieve the behavior that the average user is going to expect seems a bit silly.
      • And hence you see why we love input from "non-core" team members. This is a good fix that should be in the core. Thanks for identifying this and if you could please file an official bug report with a link back to this thread if you don’t mind. smiley
          Ryan Thrash, MODX Co-Founder
          Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
          • 4018
          • 1,131 Posts
          Better said than done! It’ll be part of the core! Thanks for the catch, pxl8r! I’m surprised that we haven’t done this sooner! Funny thing is that I had someone mention this some time ago! wink
            Jeff Whitfield

            "I like my coffee hot and strong, like I like my women, hot and strong... with a spoon in them."