We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22673
    • 72 Posts
    I have a getResources call in the template of a page. The template (tpl) for this call contains 2 other getResources calls. It seems that if I hard-code the &parents parameter for these 2 calls eg: &parents=`11`, it all works fine. But if I put &parents=`[[*id]]` or &parents=`[[*parent]]` then it doesn’t work. It seems that the 2 getResources calls in the tpl chunk cannot find the IDs for the &parents parameter.

    Is there any reason why? In MODx Evo using Ditto, this sort of thing worked fine. Is it something to do with the parsing order?
      • 22673
      • 72 Posts
      Thought it might help showing my code.

      First call in resource template:
      [[!getResources?
          &depth=`0`
          &tpl=`tplGalleryOuter`
          &sortby=`{"menuindex":"ASC"}`
          &includeTVs=`1`
          &processTVs=`1`
          &tvPrefix=``
      ]]
      


      tplGalleryOuter:
      <div class="galleryItem">
      
        [[!getResources?
          &parents=`[[*id]]`
          &depth=`0`
          &tpl=`tplGalleryImage`
          &sortby=`{"menuindex":"ASC"}`
          &includeTVs=`1`
          &processTVs=`1`
          &tvPrefix=``
          &limit=`1`
        ]]
        
        <h2>[[+pagetitle]]</h2>
        
        [[!getResources?
          &parents=`[[*id]]`
          &depth=`0`
          &tpl=`tplGalleryList`
          &sortby=`{"menuindex":"ASC"}`
          &includeTVs=`1`
          &processTVs=`1`
          &tvPrefix=``
          &offset=`1`
        ]]
        
      </div>


      tplGalleryImage:
      <a href="[[+tvGalleryImage]]" class="fancybox" rel=`[[+parent]]`><img src="[[+tvGalleryImage:phpthumbof=`w=180&h=150&zc=1&q=80`]]" width="180" height="150" border="0" /></a>


      tplGalleryList:
      <a href="[[+tvGalleryImage]]" class="fancybox" rel=`[[+parent]]`></a>
        • 22673
        • 72 Posts
        I’ve been looking at this for hours and as soon as I post the problem on here, I go and bloody solve it!

        The problem was inside tplGalleryOuter, I had [[*id]] in the &parents parameter, I changed this to [[+id]] and it now works.