FileLister.FileLister
This is a user-contributed Extra. If you find issues or would like more info or help, please contact the author.
FileLister Snippet
This snippet displays a list of files and/or directories within a given path.
Usage
Simply place the snippet anywhere and pass in a path:
[[FileLister? &path=`assets/downloads/`]]
Properties
Name | Description | Default Value |
---|---|---|
path | The path to begin browsing in. | |
fileTpl | The chunk for each file listing. | feoFile |
directoryTpl | The chunk for each directory listing. | feoDirectory |
fileLinkTpl | The chunk for the links for each listing. | feoFileLink |
dateFormat | A PHP date format for the last modified field. | %b %d, %Y |
outputSeparator | A separator that is appended to each listing. | \n |
skipDirs | A comma-separated list of directory names to always skip. | .svn, .git, .metadata, .tmp, .DS_Store, _notes |
placeholderPrefix | The prefix to append to all global placeholders set by the snippet. | filelister |
pathSeparator | The separator between items generated in the +path placeholder. | / |
pathTpl | The chunk for each item in the +path placeholder. | feoPathLink |
showFiles | If false, will hide any files from the listing. | 1 |
showDirectories | If false, will hide any directories from the listing. | 1 |
showExt | A comma-separated list of extensions to restrict output of files to. If blank, all files will be shown. If any are specified, only files with those extensions will be shown. | |
sortBy | The metric to sort by for each file. | filename |
sortDir | The direction to sort by for each file. | ASC |
allowDownload | If false, will disable viewing and downloads of any files. | 1 |
requireAuthDownload | If true, will require users be logged in to view or download a file. | 0 |
allowDownloadGroups | A comma-separated list that, if set, will restrict file viewing/downloading to users in the specified groups. | |
toPlaceholder | If set, will set the output to a placeholder with the specified name rather than directly outputting it. | |
navKey | The REQUEST navigation key used for the browsing. | fd |
homePathName | If you want to specify a custom name for the root when browsing, do so here. | |
limit | Optional. Limit the number of records that show. Use 0 for showing all. | 0 |
cls | The CSS class to use for non-alternate rows. | feo-row |
altCls | The CSS class to use for alternate rows. | feo-alt-row |
firstCls | The CSS class to use for the first row. | feo-first-row |
lastCls | The CSS class to use for the last row. | feo-last-row |
useGeolocation | If true, will use the ipinfodb Geolocation service for downloads. You must have the filelister.ipinfodb_api_key setting set to your API key for this to work. | 1 |
FileLister Chunks
There are 4 chunks that are processed in FileLister. Their corresponding parameters are:
- fileTpl - The Chunk to use for each file listed.
- directoryTpl - The Chunk to use for each directory listed.
- fileLinkTpl - The Chunk to use for each link made for each item.
- pathTpl - The chunk for each item in the path placeholder.
Examples
Display a list of only files within the 'assets/downloads/' path:
[[!FileLister? &path=`assets/downloads` &showDirectories=`0`]]
See Also
I'm still new to MODX, and found it hard to figure out what the sortorder fields are. From the forums, I found this paragraph:
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.
Suggest an edit to this page on GitHub (Requires GitHub account. Opens a new window/tab).