We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37042
    • 384 Posts
    This is kind of hard to explain so bear with me :-/

    I have a getResources call using the following chunk. Essentially, it outputs a couple of resources with a simple 2 column layout...


    • a PDF thumbnail image on the left
    • a description and download link to the right

    <div class="listing-container">
              <div class="listing-left">
                    [[+tv.Picture]]
              </div>
      
              <div class="listing-right">
                    <h2>[[+pagetitle]]</h2>
                    [[+content]]
                   [[$Get-PDF-Download]]
              </div>
    </div>
    


    Inside the above chunk, I have another chunk which calls a TV (pdf-link) where I specify a link to a PDF.

    <a href="[[+tv.pdf-link]]">Download PDF</a>
    


    My problem is the PDF link is always the first link I specify in the first resources pdf-link TV. So I end up with a list of PDFs and their description but the link is incorrect.

    Hope that makes sense? Any help would be greatly appreciated.
      ...
      • 33968
      • 863 Posts
      Can't you just ditch the second chunk and change your first to this:
      <div class="listing-container">
          <div class="listing-left">
              [[+tv.Picture]]
          </div>
         
          <div class="listing-right">
              <h2>[[+pagetitle]]</h2>
              [[+content]]
              <a href="[[+tv.pdf-link]]">Download PDF</a>
          </div>
      </div>
      

      It's more efficient.

      Otherwise try calling the second chunk uncached:
      [[!$Get-PDF-Download]]
      
        • 9102 ☆ A M B ☆
        • 318 Posts
        I've encountered this before. Lucas' solution is the simplest - just don't use nested chunks as getResources templates.

        If for some reason you really want to do it anyway, you could try passing the TV value from the first chunk into the second chunk as a parameter like this:

        Template chunk:
        <div class="listing-container">
                  <div class="listing-left">
                        [[+tv.Picture]]
                  </div>
           
                  <div class="listing-right">
                        <h2>[[+pagetitle]]</h2>
                        [[+content]]
                       [[$Get-PDF-Download? &link=`[[+tv.pdf-link]]`]]
                  </div>
        </div>
        

        Chunk Get-PDF-Download
        <a href="[[+link]]">Download PDF</a>
        
          • 37042
          • 384 Posts
          Thank you both. For the moment I went with the simpler approach. Works great smiley
            ...