Hi all, I've packaged up a very simple behavior for listing files. It's available here:
http://radiant.jmacaulay.net/files/tarballs/ file_list_behavior-0.1.tar.gz I originally created it to allow a radiant user to easily put files in a directory and have them automatically served on a download page. It uses Dir.glob to iterate over whichever files you're interested in. Here's the syntax (example currently reproduced at http:// radiant.jmacaulay.net/glob-test/): --- h3. Textile-formatted list of every PNG under /images <r:files:each glob="images/**/*.png"> * "<r:name />":<r:uri /> </r:files:each> --- By default, access is limited to files within /public, but this restriction can easily be altered by editing the valid_dir? method to suit your needs. I'll probably add support for getting more information about the files (like creation dates or permissions, for example), and I'll definitely be adding parameters for customizing the order of output. I'd love to get whatever feedback people can give me on this. Is it useful to anyone besides myself? What changes would make it most useful? Am I doing anything strange or unnecessary in my code that I could improve upon (for example, concerning my 'files' tag definition)? Cheers, James _______________________________________________ Radiant mailing list [email protected] http://lists.radiantcms.org/mailman/listinfo/radiant
