We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 15734
    • 70 Posts
    I figured it out. Very nice snippet. Works like a charm once you read all the documentation. Thanks for the help. Cheers.
      • 21112
      • 156 Posts
      I’m using FileDownload on a client’s online resource site. It’s working great for most of the pages on the site, but I’ve encountered one that’s a bit more of an organisational challenge, a conference resources page.

      At the conclusion of an annual conference, the client writes a short paragraph about each session/speaker, and links to one or more resources for each. Currently they link to the resource files from hyperlinked words within the paragraph, however I’m trying to use a new organisational concept of separating and highlighting each "resource", whether it’s a file, a link offsite or another article on the same site. This allows me to emphasise the site as a resource repository, and make it very easy for users to find the resources.

      My problem is this - There were 34 sessions in this year’s conference, and the number of files associated with each session varies from 0-9. If I list the files by directory they are not grouped by session, and the alphabetical ordering puts them all over the place. It would be too inefficient to use a separate call for each of the dozens of files, and the template would separate each call, rather than listing them nicely in a group as happens when they are called from a directory. Finally, the compromise of putting the files in a subdirectory for each session which has associated files seems overly complex and would increase the learning curve for my client when they come to create the page for this year’s conference themselves.

      My own idea of a solution would be to allow a comma separated list of individual files which can be drawn from a specified directory and displayed as a full directory list would be. I haven’t seen anywhere in the manual or discussion forum about this. Is this possible? If not, does anyone have a suggested solution better than those I mention above?

      One final related query - is there any snippet or tool that will load any file with a specified extension (eg mp3 or mov) load in a pop-up media player when those links are clicked? This would be very useful especially if it was a dynamic thing that didn’t need individual file listings to be modified.

      Thanks in advance for any help you can offer.
        • 21112
        • 156 Posts
        I’ve been experimenting a bit in this regard, to try and find a solution, and I’ve been considering using Ditto for the files. I make a weblink, use a TV for the file type icon (select from a dropdown list), write the description in another TV (far easier than editing a chunk) and format the list with a ditto template. And that works great, but there’s no way that I know of for Ditto to automatically discover and display the file size.

        Am I going about this the wrong way? Would FileDownload really be better for this? Or should I ask on the Ditto threads about getting the file size?

          • 27376
          • 576 Posts
          Quote from: neilcreek at Dec 07, 2007, 12:30 AM

          I’ve been experimenting a bit in this regard, to try and find a solution, and I’ve been considering using Ditto for the files. I make a weblink, use a TV for the file type icon (select from a dropdown list), write the description in another TV (far easier than editing a chunk) and format the list with a ditto template. And that works great, but there’s no way that I know of for Ditto to automatically discover and display the file size.
          I’ve always thought putting the file size on the page kind of cluttered the look... I would recommend putting it in an [tt]alt="Size: 12kb"[/tt] (via "Link Attributes" field) or something like that. This way if the user wants to know how big the file is, they just move the mouse over the file. A plugin ("extender" in Ditto terms) may need to made so that it reads the "link attributes" field, but I don’t work with Ditto enough to say for sure (This is a question more suited to the Ditto Forums)

          As for making an extra TV for the description, why just utilize the already existant description field? Doing so will speed up queries to the DB, keep the tmplvar_contentvalues table clean, and make for easier editing smiley In fact, now that I think of it, some or almost all of the functionality you desire could be accomplished through the use of a Ditto extender...
            • 32075
            • 13 Posts
            It’s a great snippet, many thanks.
            I have the problem that turning of friendly urls deleting a file for webuser is possible. But with turned on friendly urls (I use here index.php?q= because server doesn’t allow nicer url with htaccess rewrite rules) I get the message ’Page not found’.
            Of course I want to use this with freindly urls smiley, any ideas what to change?
            Thanks a lot!
              • 27376
              • 576 Posts
              Quote from: neilcreek at Dec 04, 2007, 11:26 PM

              I’m using FileDownload on a client’s online resource site. It’s working great for most of the pages on the site, but I’ve encountered one that’s a bit more of an organisational challenge, a conference resources page.
              @neilcreek,
              I stumbled across this interesting snippet yesterday. Maybe it does the things you want? It’s called FileDetails.
                • 27376
                • 576 Posts
                Quote from: webbear at Dec 14, 2007, 10:06 AM

                It’s a great snippet, many thanks.
                I have the problem that turning of friendly urls deleting a file for webuser is possible. But with turned on friendly urls (I use here index.php?q= because server doesn’t allow nicer url with htaccess rewrite rules) I get the message ’Page not found’.
                Of course I want to use this with freindly urls smiley, any ideas what to change?
                What do the URLs look like to delete a file? If you could, please tell us the version of MODx you’re using, Server Version (IIS, Apache, CGI), Your snippet call, and all related chunks that are used as templates in the snippet.

                There is a known issue with FileDownload Snippet and FURLs, OpenGeek wrote a solution for it that is worth trying out. If it doesn’t work, continue with paragraph one wink
                  • 32075
                  • 13 Posts
                  Thanks for your answer!
                  The url it produced was http://www.capellacaesarea.de/index.php?q=filedownload?act=712abf640154d6a25738ae185dec41c8
                  I’m using MODx 9.6, mod_rewrite isn’t allowed - where to look for the server version? (sorry...
                  In the php info is stated:
                  System : SunOS localhost 5.8 Generic_108528-17 sun4u
                  But I found a possibility to make it work:
                  The problem seems to be the second ?: ?act -> should be &act
                  Made a plugin (onWebPagePrerender) that rewrites the link to
                  http://www.capellacaesarea.de/index.php?q=filedownload&act=712abf640154d6a25738ae185dec41c8

                  And now it works fine.
                  Maybe not very professional... wink


                    • 28189
                    • 47 Posts
                    laugh laugh laugh laugh laugh laugh

                    Absolutely terrific!!!

                    Thanks for making such a nice snippet!
                      • 11445
                      • 3 Posts
                      There seems to be a problem with 0.9.6.1 and FileDownload.


                      « MODx Parse Error »MODx encountered the following error while attempting to parse the requested resource:
                      « PHP Parse Error »

                      PHP error debug
                      Error: array_values(): The argument should be an array
                      Error type/ Nr.: Warning - 2
                      File: /-snip-/modx-0.9.6.1/assets/snippets/filedownload/filedownload.class.inc.php
                      Line: 260
                      Line 260 source: $values = array_values($v);

                      Parser timing
                      MySQL: 0.0092 s (6 Requests)
                      PHP: 0.0411 s
                      Total: 0.0503 s

                      Any ideas what might be causing this and how I might be able to debug it? Or is there a known fix available somewhere?

                      Thanks.