Jump to main content Jump to doc navigation

What is FileLister?

FileLister is a dynamic file listing Extra for MODX Revolution. It allows you to list files within a directory, as well as securely browse through subdirectories.

Requirements

  • MODX Revolution 2.0.0-rc-2 or later
  • PHP5 or later

Historyand Info

FileLister was written by Shaun McCormick (splittingred) as a dynamic file listing component, and first released on June 30th, 2010.

Download

It can be downloaded from within the MODX Revolution manager via Package Management, or from the MODX Extras Repository, available here: https://modx.com/extras/package/filelister

Development and Bug Reporting

FileLister is stored and developed in GitHub, and can be found here: http://github.com/splittingred/FileLister

Usage

FileLister can be called via the Snippet tags, and passing a 'path' argument.

Snippets

FileLister comes with one snippet:

System Settings

Name Description
filelister.salt A custom salt for the navigation.

Examples

List all the files and directories in assets/downloads.

[[!FileLister? &path=`assets/downloads/`]]

List only files in the 'assets/pdfs' directory.

[[!FileLister? &path=`assets/pdfs/`]]

List all files and subdirectories in '/docs/marketing', but don't allow file viewing or downloading except for users logged in and in the 'Marketing' or 'CEO' groups.

[[!FileLister? &path=`/docs/marketing/` &allowDownloadGroups=`Marketing,CEO`]]

Restrict file listings in 'assets/pdfs' to only PDF files:

[[!FileLister? &path=`assets/pdfs/` &hideDirectories=`1` &showExt=`pdf`]]

Sample Resource Content

This is a sample of HTML that you can put inside a Resource to output your content. You'll need to have the toPlaceholder property set to 'files' for this to work, and call your FileLister snippet uncached before this HTML.

<h2>Files</h2>

<p>Current Path: <span>[[+filelister.path]]</span></p>

<table>
    <thead>
        <tr>
            <th>Name</th>
            <th>Filesize</th>
            <th>Last Modified</th>
        </tr>
    </thead>
    <tfoot>
        <tr>
            <th colspan="3">
                Files: [[+filelister.total.files]] | Directories:
                [[+filelister.total.directories]]
            </th>
        </tr>
    </tfoot>

    <tbody>
        [[+files]]
    </tbody>
</table>

See Also

  1. FileLister.FileLister
    1. FileLister.FileLister.directoryTpl
    2. FileLister.FileLister.fileLinkTpl
    3. FileLister.FileLister.fileTpl
    4. FileLister.FileLister.pathTpl

Support the team building MODX with a monthly donation.

The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.

Backers

  • modmore
  • STERC
  • Digital Penguin
  • Jens Wittmann – Gestaltung & Entwicklung
  • Fabian Christen
  • Dannevang Digital
  • Sepia River Studios
  • CrewMark
  • Chris Fickling
  • deJaya
  • Lefthandmedia
  • Murray Wood
  • eydolan
  • Following Sea
  • Anton Tarasov
  • Stéphane Jäggi
  • Raffy
  • Snow Creative
  • A. Moreno
  • Nick Clark
  • JT Skaggs
  • Helen
  • YJ
  • krisznet
  • Richard
  • Yanni

Budget

$301 per month—let's make that $500!

Learn more