We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36860
    • 21 Posts
    I have been using this for a while, but I need to know if there are ways to sort the files displayed? I'd really like it to be sorted by post date, size or something other than alpha?
      • 32316
      • 387 Posts
      whistlemaker Reply #2, 15 years ago
      I'm interested in the answer to this so I dug ...

      from the docs (check here: http://rtfm.modx.com/display/ADDON/FileLister.FileLister)
      there are sortBy, and sortDir properties - defaults are filename and asc (ascending)

      Now the choices for the parameter values are not so clear from the docs - so fire up an editor and open the sort.algorithms.php file in filelister/includes directory and we find there are four choices - extension, lastmod, bytesize, and filename.

      So then I try it - but it does not seem to work, but it is very late, maybe when I'm fresh in the morning it will work!
        • 36860
        • 21 Posts
        whistlemaker,

        Thank you so much. I am looking forward to what you find out.
          • 36860
          • 21 Posts
          whistlemaker,

          I played around with it myself and got it working. If you make the call like this

          !FileLister? &path=`assets/downloads/` &sortBy=`lastmod` &sortDir=`DESC` &outputSeparator=` br / br /` -NOTE you do need <> in the tag for the br /

          It will sort it descending by date. I imagine if you wanted to do bytesize, extension, lastmod, or filename (default) it's just matter of changing the call to reflect it. To change direction of the sort you need the DESC or ASC in the sortDir call.

          Did you happen to find anything on what it displays and how to change it. Eg. Filename, Filesize, Last modified, Times Downloaded - are all displayed.

          Thank you so much for taking a look at this, I never would have found it by myself.
            • 32316
            • 387 Posts
            whistlemaker Reply #5, 15 years ago
            I finally got around to looking at this.
            I tried extension, lastmod, bytesize, and filename for &sortBy - bytesize did not seem to work for me all the others did, as does the sort direction.

            Did you happen to find anything on what it displays and how to change it. Eg. Filename, Filesize, Last modified, Times Downloaded - are all displayed.
            Look in the docs for placeholders: http://rtfm.modx.com/display/ADDON/FileLister.FileLister.fileTpl