Sort File Lists By Date?
Permalink 1 user found helpful
How can I sort file lists by date? There's a method for filtering by date, but I would prefer to be able to simply sort the list based on the date the file was uploaded, either ascending or descending. Is there any way to do this other than loading each file object and doing it myself?
Thanks!
Thanks!
check out the FileList class. & there should be a method there specifically for sorting by date.
I see ... it was hidden in there. What I needed was "sortBy," which was defined in a parent class, as well as the tag for date, which took some hunting to find.
Thanks Tony
Thanks Tony
Any chance you have some sample code? I need to do this as well (sort a filelist, which I'm pulling from a file set, by date added).
Thanks!
Bill
Thanks!
Bill
Loader::model('file_list'); $fl = new FileList(); $fl->sortBy('fDateAdded', 'asc'); $files = $fl->get();
How about that?
Very nice!
Thanks much! (quick reply too!)
Bill
Thanks much! (quick reply too!)
Bill