We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 18374
    • 69 Posts
    I’ve got the snippet installed and working great! Thanks for the hard work.

    One new question - I have a client who is linking to individual files within the RTE (writing out a title, and linking the text to the file in TinyMCE via the FCKeditor file browser). Any suggestions for automatically appending a FileDetails snippet call to the end of each link they insert? That way when the page is rendered each link will have the data shown without any additional work on the client’s part (they’re not exactly tech-savvy anyway smiley )

    I know this would be a piece of cake using jQuery but I think it (haven’t tested) would just render the text of the call since MODx completes all the parsing before jQuery’s document.ready().

    The RTE could contain anywhere from a single file to dozens of individual files so I don’t want to set them up as individual documents or TVs. Unless there’s another approach I haven’t thought of!
      • 29774
      • 386 Posts
      You could use jQuery to add a clone button below a single file tv, allowing your client to select one or more files per page. You would need to recombine the file urls into a comma-delimited string and pass it to the value of the original file tv input. You would also need to do the reverse for editing a document (split the field value into multiple cloned fields). This would be ideal as a ManagerManager widget.

      You could then write a small snippet to explode() the file tv value into an array, loop through it and run FileDetails for each url.

      An alternative to this approach that might solve your specific problem would be to write a plugin to search the page output with a regexp just before it’s sent to the browser for any urls that contain the string ’/assets/files/’ (ie the directory where all your files are stored), and do $modx->runSnippet(’FileDetails’),$paramArray) on each matched url.
        Snippets: GoogleMap | FileDetails | Related Plugin: SSL
        • 3232
        • 380 Posts
        This looks like a great plugin but I can’t seem to get it to work.

        I am using Evo 1.0 and I followed the directions. I am trying to use archive mode using the following call:

        [!FileDetails? &archive=`TRUE` &dittoSnippetParameters=`parents:13|sortBy:menuindex|sortDir:ASC`!]

        If I change the parents id to something that doesn’t exist I get the output of "The Ditto object is invalid. Please check it." so I know that snippet is working.
        The only output I get is <dl></dl>

        What could I be missing or doing wrong?
          • 29774
          • 386 Posts
          Have you created any documents in the container with id 13? These documents will need to have a tv called ’file’ assigned to their template.
            Snippets: GoogleMap | FileDetails | Related Plugin: SSL
            • 3232
            • 380 Posts
            Quote from: therebechips at Aug 04, 2009, 06:02 AM

            Have you created any documents in the container with id 13? These documents will need to have a tv called ’file’ assigned to their template.

            That was the problem. I missread the directions and created the tv name ’File’

            Thank you for your help!
              • 29774
              • 386 Posts
              No problem glad you worked it out smiley
                Snippets: GoogleMap | FileDetails | Related Plugin: SSL
                • 8280
                • 9 Posts
                Hi, and thanks for the useful snippet.

                I successfully used Ditto and FileDetails to create a list of PDFs with pagination:

                [!Ditto? depth=`0` &orderBy=`pub_date DESC` &filter=`hidemenu,0` &tpl=`showPDF` &summarize=`10` &paginate=`1` &paginateAlwaysShowLinks=`1`!]


                and the Chunk:

                <dt><a href="[+tvfile+]">[+title+]</a></dt>
                <dd>[!FileDetails?file=`[+tvfile+]` !]</dd>
                


                this worked fine, except I couldn’t configure which metadata was displayed for each file (specifically, I wanted to remove ’filedate’). So I changed the call to this:

                [!FileDetails?&archive=`TRUE` &tpl=`showMeetingMinutes` &dittoSnippetParameters=`parents:1|sortBy:pub_date|sortDir:DESC|paginate:1|summarize:10|paginateAlwaysShowLinks:1|depth:0|filter:hidemenu,0`!]


                and the chunk:

                <dt><a href="[+filelink+]" title="Download [+filename+].pdf">[+filetitle+]</a></dt>
                <dd>[+fileicon+]  [+filesize+] </dd>


                and now the Ditto pagination code (below my FileDetails call) can no longer see the Ditto variables, and pagination no longer works.

                Is it possible to get pagination working by calling Ditto through FileDetails?