We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4488
    • 10 Posts
    Does anyone know how to set FileLister so the items appear as a list?
    Example of what I want it to do:

    First download file
    Second download file
    Third download file

    Currently it does this:

    First download file Second download
    file Third download file

      • 27591
      • 1 Posts
      I have the same question. Seems so simple, but I’m not not getting it to display right.
      Any help would be appreciated.
        • 1778
        • 659 Posts
        Hello

        From rtfm :
        In http://rtfm.modx.com/display/ADDON/FileLister.FileLister you can read :


        Properties

        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.

        And reading further

        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.

        Then to understand what is what and how it works (and how you can modify it) jump to the doc for each chunk
        http://rtfm.modx.com/display/ADDON/FileLister.FileLister.fileLinkTpl (and others). You’ll find there a description of all the placeholders available so you can create your own chunks.

        Once you’ve created your chunk(s), you simply indicate to FileListe which "minitemplate" to use to display this part ...

        Something like :
        [[FileLister? &path=`assets/downloads/` &fileTpl=`myChunkForFileTpl` &fileLinkTpl=`myChunkToDisplayTheLinks`]] 
        


        Pretty easy no ?

        Lot of add-ons work the same way, once you’ve understand that, reading the doc inform you about availables properties (ie: chunks used as mini-templates for each part, and all other parameters you can pass in you snippets calls), and very often each Tpl used is provided as example. From there you can create your owns and play with them to display the things eaxactly the way you want.

        Hope this will be of use to you
        Cheers
          • 1892
          • 82 Posts
          For creating a list of files I used the following setup.

          I created a property set called FileListerCherry where I set the toPlaceHolder parameter to "files". The following code then just goes in the resource content, this just uses the standard feoFile template supplied in the package.


          [[!FileLister@FileListerCherry]]
          <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>
          <tbody>
          [[+files]]
          </tbody>
          </table>


          Hope this helps.
          Adrian
            • 36963
            • 22 Posts

            I see very clearly how it should work (as any other snippet), but it is still weird to get the output as a raw dump of links like @Anso is saying ...

            What I mean is that fileLister does contain the default HTML blocks for the fileTpl, dirTpl parameters (found @ core/components/filelister/elements/chunks/ ) but these are not being used for the output when using the basic call of the snippet !

            What can cause the MODx engine to fail in finding the chunks in the correct location ?!?


            Cheers, Luca