We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 46327
    • 2 Posts

    Probably a very noob error, but i'm having some trouble with getResources.

    My Chunk:
    <li>[[+idx]] - [[*id]] - [[*pagetitle]]</li>

    This outputs (there are two 'children' of page number 13):
    <li>1 - 13 - Beoordelingen</li>
    <li>2 - 13 - Beoordelingen</li>

    The wayfinder plugin:

    <ul><li class="first"><a href="nl/overzicht/beoordelingen/redacted1.html" title="redacted1" >redacted1</a></li>
    <li class="last"><a href="nl/overzicht/beoordelingen/redaccted2.html" title="redaccted2" >redaccted2</a></li>

    Why does the inner loop of getResources does show the id twice of the page i'm on, not the two child pages?

    I'm having a folder with all hidden content (like blog posts) and the page i'm on is the overview page.

    Thanks for helping me out!
    • Two issues I see here, one not necessarily critical but a very bad habit, and the other the cause of your problem.

      For the problem, you are using resource field tags [[*id]] and [[*pagetitle]]. So this will give you those values for the current page... the page that has the snippet calls on it. You need to use placeholder tags [[+id]] and [[+pagetitle]] tags to get the values that the snippets have for each item they are listing.

      The bad habit is how you are using the snippet tags. It is better to use them like this
       [[getResources? &showHidden=`1` &parents=`13` &tpl=`myTpl` &includeContent=`1`]]

      While the way you have it will work, if there happen to be any spaces in the values then it will break.
        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
        • 46327
        • 2 Posts
        Thank you for your awesomely correct answer!
        And also thanks for informing me about my bad habit, will quit right now! ;-)