I’m trying to find a simple snippet to output a list of html files in a folder (sorted by date, descending). The folder name is related to the modx document that calls the snippet. Something like ditto, but gets the files from a non-modx folder. Even better would be something like maxigallery, but works with html files, not images. I’ve looked at FileDownload, which lists the files OK, but I just want to link the files to the source, not download or delete them.
Has anyone written anything like this?
Thanks
RuthEd
-
☆ A M B ☆
- 24,524 Posts
If you’re using PHP 5, you can use this function in a snippet
http://www.jellyandcustard.com/2006/05/18/using-directoryiterator-to-list-files-in-php/
Here is a nice function for getting files in the order of their creation; it’s the first user comment on this page
http://il.php.net/manual/en/function.filectime.php
Wonderful, thanks. Just what I wanted. With a small amount of fiddling I’ve got it using the title from the html files as the text for the links.
Thanks again
RuthEd