We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 11190
    • 109 Posts
    Hello, all. I am very new to html and MODx. I am working on a site which offers some free pdf documents and videos. It is important that I know how many times each file has been downloaded. We may wish to display this information along with the link. I have been playing with the FileDownload snippet and the FileDownloadPlugin but they are not quite what I am looking for.

    The aesthetics of the download pages are somewhat important. The layout calls for a description of the work, a cover picture for the books and a still frame for the video. These images should be live links to download as well as a simple Download [book title] text link. I did not see how to use anything but icons tied to file extensions in FileDownload and the icons are not live links anyway. I also don’t see how it would count downloads regardless of whether they clicked on the image or the text link.

    I would imagine this is a simple and basic function - count the number of times a file has been downloaded - but I don’t know how to do it. Can anyone point me in the right direction? I don’t mind reading and researching but haven’t been able to find anything on this yet. Maybe I’m just googling with the wrong vocabulary. Thanks - John
      http://www.spiritualoutreach.com
      Making Christianity intelligible to secular society
      • 11190
      • 109 Posts
      After lots of experimenting, I was able to achieve what I wanted with a combination of the FileDownload snippet and the FileDownloadPlugin. Many thanks to the authors! I’ll document what I did in this posting in case some one else as ignorant as I am finds themselves struggling with the same issues.

      First, we wanted a very non-technical looking layout - a large image link with a descriptive text download link rather than a file listing. Second, we needed to track downloads whether the user clicked on the image or the text link. To our great delight, the FileDownloadPlugin tracks all the downloads even if there are multiple FileDownload snippet calls on the same page for the same file.

      Thanks again to the FileDownload snippet author for making it so flexible. We decided to use two snippet instances for each download. Here is the layout of a download section:

      Book:

      [!FileDownload? &getFile=`ChristianJourney.pdf` &chkDesc=`fileimages` &tplList=`downloadimagelayout` !]Suggested donation: US$5.50

      [!FileDownload? &getFile=`ChristianJourney.pdf` &chkDesc=`filedescriptions` &tplList=`downloadlayout` !]

      We realized we could use an image tag for a file description so we created a chunk for that:
      {{fileimages}}
      assets/files/ChristianJourney.pdf|<img src="assets/images/ChristJournCover.jpg" alt="Christian Journey Download" title="Download The Christian Journey book" height="332" width="250" style="float:left;vertical-align:top;margin:0px 8px 25px 8px;" />||

      We used the filedescriptions chunk to create the more friendly text download content.

      We then completely restructured the display templates and created one for images and another for text. We removed the tables and replaced the file names with the descriptions:

      {{downloadimagelayout}}
      <!-- Fd:Splitter -->
      <!-- Fd:Splitter -->
      <!-- Fd:Splitter -->
      <a href="[+fd.link+]" target="_blank">[+fd.description+]</a>
      <!-- Fd:Splitter -->
      <!-- Fd:Splitter -->
      <!-- Fd:Splitter -->

      {{downloadlayout}}
      <!-- Fd:Splitter -->
      <!-- Fd:Splitter -->
      <!-- Fd:Splitter -->
      <p>
      <a href="[+fd.link+]" target="_blank">[+fd.description+]</a>

      Size: [+fd.sizetext+] &nbsp;&nbsp;&nbsp;Total Downloads: [+fd.count+]
      </p>
      <!-- Fd:Splitter -->
      <!-- Fd:Splitter -->
      <!-- Fd:Splitter -->

      I’m sure this is "teaching my grandmother to suck eggs" for those who are more experienced but I hope it helps someone else like me! All suggestions for improvement gratefully considered. Thanks again - John

        http://www.spiritualoutreach.com
        Making Christianity intelligible to secular society
        • 27708 MODX Staff
        • 2,502 Posts
        Any how-tos are completely appreciated for those of us who may not have ever tried to do what you wanted to do but may someday. It might be good to do a Wiki post as well.
          Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. Blog ✦ Twitter ✦ LinkedIn ✦ GitHub
          • 7923
          • 4,213 Posts
          Yes, thanks for writing up your findings.. It would be very great if you could write it to the MODx wiki.. It’s easier for others to search information / tutorials from the wiki than from these forums. Thanks again for your time. We certainly need these tutorials.


            "He can have a lollipop any time he wants to. That's what it means to be a programmer."
            • 11190
            • 109 Posts
            OK, if you think it will be helpful. It seemed like such a simple thing that just befuddled me because of my lack of experience. I’ll see if I can find the time somewhere to get it on the wiki. I know I’ve been very grateful for the help I’ve received from the MODx community - John
              http://www.spiritualoutreach.com
              Making Christianity intelligible to secular society