We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37942
    • 30 Posts
    Hey Everyone,

    Might seem a strange question but i'm a little stuck here! Simply said: can i getResources within a getResources call?

    Bit more explained version of my question:

    I've got a getResources calling all the subfolders of a resource, now i want to display the resources within the subfolder aswel.

    This is what i got now, and this obviously isn't working:

    I call this on the 1st page:
    [[!getResources? &parents=`[[*id]]` &tpl=`X` &depth=`0` &includeContent=`1`]]


    TPL X is:
    <section class="categories-span">
    <h4>[[+pagetitle]]</h4>
    [[!getResources? &parents=`[[*id]]` &tpl=`Y` &depth=`1` &includeTVs=`1` &processTVs=`1`]]
    </section>
    <hr>


    As you see the tpl above calls another getResources (A dynamic one, it should read the id of the child's but it now prints out the id of the parent)

    TPL Y is:
    [[+tv.product-topimg]]
    <span class="description">[[+tv.product-title]]</span>


    Result of this:
    It does read out the things i want to read out, but unfortunately it picks the id of the parent. Combining all de resources in one, which shouldn't be.

    Might sound like a strange question but i'm kinda stuck here. Thanks in advance!

    Cheers,
    Nick

    This question has been answered by multiple community members. See the first response.

    [ed. note: niintek last edited this post 12 years, 11 months ago.]
    • discuss.answer
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Remember, when you are working within a getResources (or any other listing snippet) tpl, [[*...]] refers to the current whole page being generated - in this case, your parent resource. To get the "current" resource being processed in the tpl, you need to use [[+...]]
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
      • discuss.answer
        • 22303 MODX Staff
        • 10,725 Posts
        Your nested getResources call should be using
        [[+id]]
        not
        [[*id]]
        .
          • 37942
          • 30 Posts
          Thank you so much! I must admit, i feel really stupid right now. Especially since i already knew this! Isn't it weird how you can dig so deep into finding a solutions and in the end it seems like you've bin sitting on top of it all the time?

          Thanks sottwell and opengeek for the answers!
            • 38290
            • 712 Posts
            It's getResources inception!
              jpdevries