We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 23383
    • 138 Posts
    Nice link susan ! Thanks smiley

    Still thinking about it ? Do you plan to implement it ? laugh
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Someday. I’ve got a few other things on the to-do list ahead of it, though.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 7231
        • 4,205 Posts
        @neilcreek: It seems that you can style the template chunk and use the only the placeholders you want ’[+size+]’, ’[+icon+]’, ’[+filedate+]’
          [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

          Something is happening here, but you don't know what it is.
          Do you, Mr. Jones? - [bob dylan]
          • 21112
          • 156 Posts
          Thanks for the suggestion - I must have overlooked that on the snippet page, as I have found it there now that you pointed it out.

          It took me a bit, but I got it working! The instructions on the snippet page indicate the correct term is [+filesize+], which I couldn’t get to work. When I tried your suggestion of [+size+] however, it worked perfectly! Thank you.

          Perhaps it would be a good idea to edit the snippet page with the correct code.

          [Update]
          I’ve encountered a new problem. I can’t get the filename to display. [+filename+] [+name+] or any other combination doesn’t work. Neither does [+title+] which is where I’ve put the file name in the web link. The [~[+id+]~] I’ve used for the link works just fine, but I can’t call [+title+]. I’m sure I’m doing something wrong, but I can’t find it.
            • 7231
            • 4,205 Posts
            I don’t think it returns the file name. In the example in the first post the author is getting the file name from the ditto (he actually used the outdated NewsListing) template:

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

            It is my understanding that this snippet will only return file information but not the file name. Since you are providing the filename as a parameter it assumes that you already know this information.
              [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

              Something is happening here, but you don&#39;t know what it is.
              Do you, Mr. Jones? - [bob dylan]
              • 21112
              • 156 Posts
              Note: My initial problem has been solved, but I now have a new one, see Update 2 below.

              I’m actually trying to display [+title+] from ditto as well, or if I can’t get that to work, [+filesize+] which is listed on the snippet’s page as one of the template placeholders which can be used.


              Placeholders to use in $tpl:

              [+filename+] - filename
              [+filelink+] - link to the file
              [+fileicon+] - file icon
              [+filesize+] - file size
              [+filedate+]- file date
              http://modxcms.com/FileDetails-1.1-1125.html


              [Update] *Slaps own forehead*

              I was trying to put the page title in with the placeholder [+title+]. I forgot that, despite the name of the field in the page editor, the correct placeholder is [+pagetitle+]. That works correctly. It’s so often the simple, overlooked answer isn’t it?

              Sorry to bother you smiley

              [Update 2] Now I’ve encountered a new problem.

              I want to list two seperate groups of files on the same page, but it seems the page will not render of the snippet is called more than once. I know Ditto calls can be used more than once, but as soon as I add another FileDetails snippet, the page will not render. This also occurs if I try to call more than one item via the same Ditto call, by listing a series of comma seperated &documents To clarify, I’ve put the FileDetails snippet in the Ditto template, and the FileDetails snippet then calls its own template.

              I will have other pages in which I will want to display many groups of files, over twenty, so whatever solution is suggested will need to allow for that.

              Any ideas?

                • 7231
                • 4,205 Posts
                Maybe try using the snippet uncached [! !]. By looking at the example page in the authors post it seems that it should be able to work as you want.
                  [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

                  Something is happening here, but you don&#39;t know what it is.
                  Do you, Mr. Jones? - [bob dylan]
                  • 21112
                  • 156 Posts
                  Thank for the suggestion, I gave that a try earlier, and unfortunately it didn’t work. What happens is that the FileDetails call in its entirety is rendered as plain text. Following is an example of what is displayed where the templated FileDetails result should be seen:

                  [!FileDetails?file=`/documents/events/photorules.doc` &tpl=`FileDetailsTpl` &icondir=`images/`!]
                  


                  To help diagnose the problem, I’ll show you the various parts of the code:

                  This is the Ditto call on the page:
                  <div class="filecontianer">{{filecontainertop}}
                  [!Ditto? &documents=`106` &display=`all` &sortBy=`createdon` &sortDir=`DESC` &tpl=`DittoFileTemplate` !]
                  </table>
                  </div>
                  

                  (The {{filecontainertop}} chunk calls a table which wraps the output with three columns and title cells)

                  This is the Ditto template DittoFileTemplate:
                  [[FileDetails?file=`[+longtitle+]` &tpl=`FileDetailsTpl` &icondir=`images/`]]
                  <tr><td colspan="3" style="margin:0 15px 0 0;  padding:0;"><p style="margin:0; padding:0 0 0 38px;">[+longdesc+]</p></td></tr>
                  


                  This is the FileDetails template FileDetailsTpl:
                  <tr style="margin:0; padding:0;"><td width="35px" align="center" style="margin:0;">[+icon+]</td>
                  <td width="435px" style="margin:0;"><p style="margin:0; padding:0;"><a href="[~[+id+]~]">[+pagetitle+]</a></p></td>
                  <td width="70px" style="margin:0;"><p  style="margin:0 15px 0 0; padding:0; text-align:right;">[+size+]</p></td></tr>
                  



                  Please note that this is in-development code, and has yet to be cleaned up and optimised.

                  In all cases where there is more than one Ditto call on a page using that template, or where there is one Ditto call with more than one &documents value, the first displays correctly, but the second displays only the parts of the Ditto template not generated by the script.
                    • 7231
                    • 4,205 Posts
                    Shot in the dark here, but since only the first instance is being parsed and the rest are showing as text may be related to the cache. Have you tried reversing the order so that the Ditto call is cached [[ ]] and the FileDeteils is un-cached [! !].
                      [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

                      Something is happening here, but you don&#39;t know what it is.
                      Do you, Mr. Jones? - [bob dylan]
                      • 29774
                      • 386 Posts
                      @neilcreek
                      If you call Ditto cached [[Ditto]], FileDetails should be called uncached inside the Ditto template [!FileDetails!] (or vice versa).

                      Note that I have updated the snippet to v1.2, it will now return more placeholders, including the filename (just the file name, stripped of the path and extension). Note that the generated placeholder names have been changed to prevent conflicts, as follows:
                          [+filename+] - filename
                          [+filelink+] - link to the file
                          [+fileicon+] - file icon
                          [+filesize+] - file size
                          [+filedate+] - file date
                      

                        Snippets: GoogleMap | FileDetails | Related Plugin: SSL