We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 47086
    • 4 Posts
    I am pretty new to this but it seems pretty straight forward. I am trying to limit returned resources to 3.

    Here is the Snippet call
     [[!getResources? &limit=`3` &tpl=`partnerGallery` &parents=`2`]]
    


    The snippet is working fine, but... it always returns all 4 child resources in the parent container?

    Any suggestions? I have been looking at this for way too long!

    This question has been answered by randybow. See the first response.

      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Odd... just did a quick trial, and it's working as expected for me. Are you sure that's exactly your snippet call? Usually something not working like this can be using single-quotes '' instead of backticks `` around the property value.
        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
        • 47086
        • 4 Posts
        Quote from: sottwell at Apr 01, 2014, 09:40 PM
        Odd... just did a quick trial, and it's working as expected for me. Are you sure that's exactly your snippet call? Usually something not working like this can be using single-quotes '' instead of backticks `` around the property value.

        I have retyped it several times being careful to use the backtick. I have checked that I am using the same characters for all the property variables. The &tpl and &parents parameters are passing correctly as I am getting the properly formatted results I expect. I just get all four..
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Try deleting all of the files and folders in the core/cache/ folder. MODX will re-write them as necessary. Sometimes things get hung up in those cache files, and it's one of the more basic troubleshooting techniques when strange things are happening.

          Another thing to try is to uninstall, remove, then re-install the offending package. Or, you could try installing pdoTools and using its pdoResources, which is a drop-in replacement for getResources that works a little differently. That won't answer the question of why getResources is behaving like this, but getting the site up and working is the main thing.
            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
            • 47086
            • 4 Posts
            I am still not getting correct results from the getResources snippet. I have deleted the files and folder in the core/cache folder and uninstalled and reinstalled the getResources package.

            I have also created a second instance using the same parent container. This result is even worse. I am getting 4 copies of the parent's elements and no content from the children.

            Here is the second call. Again, very straight forward and simple, yet not working.
            <ul>
            [[!getResources? &tpl=`partnerFull` &parents=`2`]]
            </ul>


            Is there any way to diagnose this issue more precisely? Could I have an issue with the .php configuration? I am at a loss...
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              In your tpl, are you using placeholders [[+whatever]] or resource fields [[*whatever]]?
                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
                • 47086
                • 4 Posts
                I was/am using placeholders.

                However, the issue now seems to have resolved itself. For an unrelated reason, I decided to name these chunks slightly differently. This involved changing the name of both the snippet's tpls and the html "sections" calling them. As soon as the names were changed the getResource calls began working as expected. No clue why, but for now I take it as a win.