We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 33337
    • 3,975 Posts
    Is this template wrong ?
    <div class="downloads">
    <div class="file">
    <a class="dload-img" href="[+link+]" title="Download [+filename+]">
    <img class="dload-img" src="assets/images/download.png" alt="Click to download template files." />
    </a>
    <br />
    <strong>Size:</strong> [+sizetext+]<br />
    <strong>Downloads:</strong> [+counter+]
    </div>
    </div>
    


    I started to customize the template according to my needs, but when I put this in chunk, the snippet stoped rendering dynamic values ([+value+]).

    This works fine:
    <div class='downloads'>
    <h2>Download [*pagetitle*] Files</h2>
    <hr>
    <div class='file'>
    <!-- [+image+] -->
    <strong>Link:</strong> <a href="[+link+]" title="Download [+filename+]">[+filename+]</a><br />
    <strong>Size:</strong> [+sizetext+]<br />
    <!-- Date: [+date+]<br/> -->
    <strong>Downloads:</strong> [+counter+]</div>
    </div>
    

    I think user should have complete freedom over template flow ? no ? I appreciate your elaboration in this regard.
      Zaigham R - MODX Professional | Skype | Email | Twitter

      Digging the interwebs for #MODX gems and bringing it to you. modx.link
      • 15987
      • 786 Posts
      Zi, you can customize the template chunk however you want, but there are a couple of things needed for it to function correctly. I have the template split into three parts using the <hr> tags, these are removed for the final output, but need to be in your chunk. The format for the template should look like the following:

        Header markup
        <hr>
        Markup repeated for each file (including placeholders)
        <hr>
        Footer Markup
      


      So if you change your template to this it should work:

      <div class="downloads">
      <hr>
      <div class="file">
      <a class="dload-img" href="[+link+]" title="Download [+filename+]">
      <img class="dload-img" src="assets/images/download.png" alt="Click to download template files." />
      </a>
      <br />
      <strong>Size:</strong> [+sizetext+]<br />
      <strong>Downloads:</strong> [+counter+]
      </div>
      <hr>
      </div>
      


      Let me know if that makes sense and fixes your problem.

      Kyle
        • 33337
        • 3,975 Posts
        So I was missing <hr> for section separation. lol

        Thank you very much for explanation! It works like a charm.

        regards,

        zi
          Zaigham R - MODX Professional | Skype | Email | Twitter

          Digging the interwebs for #MODX gems and bringing it to you. modx.link
          • 33453
          • 141 Posts
          Kyle,

          I want to download a directory containing 2 subdirectories with several files in each. I do not want the user to browse these directories - it should be all or nothing.

          Is that possible with this snippet? Previously I have not been able to download this structure as it just keeps opening the directories until it gets to the end of the trail.

          Thanks
            • 15987
            • 786 Posts
            Quote from: zenmaster at Jun 01, 2006, 01:42 PM

            I want to download a directory containing 2 subdirectories with several files in each. I do not want the user to browse these directories - it should be all or nothing.

            So are you saying you want it to have one link to download all files?

            If so, that will not work with this snippet and you would probably need to zip them up and then provide the single file link.

            If you want it to display all of the files in each directory you could use the snippet call twice on the same page to display a listing of each folder.

            If you don’t want the user to browse directories you should leave the &browseDirectories parameter to default.

            Let me know if you have any other questions or need some help.

            Kyle
              • 33453
              • 141 Posts
              Thanks, Kyle.

              Unfortunately they do not want a zip file as the files are to be loaded directly to a mobile device which does not have zip/unzip facilities.

              I shall just have to think of a work around.
                • 15987
                • 786 Posts
                You could probably use parts of my snippet and modify it to loop through each file in the directory and start the download for each file.
                  • 31112
                  • 36 Posts
                  Hi.
                  It’s possible to use an extern link for the folder path ?
                    Sorry for my english, it’s not my natural language. smiley
                    • 15987
                    • 786 Posts
                    Currently the code is written to use a relative path, so no you cannot use an external folder link.
                      • 31112
                      • 36 Posts
                      Ok. maybe for a futur update. smiley
                        Sorry for my english, it’s not my natural language. smiley