We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 31104
    • 108 Posts
    Hey guys, I'm not sure if I'm asking this correctly but basically this is what I want to do:

    I have my getResource call in a chunk because I want to call it from multiple pages and in different languages.

    [[!getResources? &parents=`[[+parent]]` &tpl=`list-docs-thumb-tpl` &limit=`100` &sortdir=`ASC`]]


    So now when I call the chunk I want to do this:

    [[$gr_chunk? &parent=`12`]]


    But it's not working, am I approaching this the wrong way?


      • 3109 ☆ A M B ☆
      • 894 Posts
      Did you try changing the parent placeholder to another name? It might be that it's confusing it because the syntax is correct AFAIK.
        Benjamin Marte
        Interactive Media Developer
        Follow Me on Twitter | Visit my site | Learn MODX
        • 31104
        • 108 Posts
        Thanks benmarte, I had tried that already but did so again just to make sure, and no cookie.

        It works fine if I remove the placeholder and type the resource id directly in the getResources call but it defeats the purpose of having the call in a chunk in the first place.

        Could it be because the &parents=`` parameter is already a snippet parameter and I'm trying to turn it into a chunk parameter? so I'm passing a chunk parameter into a snippet parameter.

        Anyways, I'm probably better off just calling getResources directly in the resource instead of adding the extra chunk.

        What I wanted to avoid was having to change the call in 100 different pages if I ever decided to modify my getResource call or add a parameter, etc.
          • 4172
          • 5,888 Posts
          do you need getResources uncached, for some reason?

          If not, try it cached:
          [[getResources? &parents=`[[+parent]]` &tpl=`list-docs-thumb-tpl` &limit=`100` &sortdir=`ASC`]]


          or try to call the chunk also uncached:
          [[!$gr_chunk? &parent=`12`]]
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 31104
            • 108 Posts
            Thanks Bruno17, I had no idea we could uncache chunks, (good to know), I gave it a whirl and still nothing.

            Anyhow, I take it that it's possible then, if you guys are saying that the syntax is correct. So it's probably me or something else conflicting with the call. I'm working with w3c valid code, so I can rule out html errors.

            I'll keep working other aspects of the site to clear my mind and get back to this later, if I figure out what I did wrong, I'll post it here.

            Thanks again.
              • 3749
              • 24,544 Posts
              Try changing 'parent' to 'my_parent' in both places. That will make sure it's not colliding with another use of 'parent' in the $scriptProperties array.


              ------------------------------------------------------------------------------------------
              PLEASE, PLEASE specify the version of MODX you are using.
              MODX info for everyone: http://bobsguides.com/modx.html
                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting
                • 31104
                • 108 Posts
                Thanks BobRay, I did that again and went through a lot of names (always clearing cache in between), but it must be something else, so I just hardcoded the resource in the call and went on with my life, it's a very simple site anyways, so it wasn't worth jumping too many hoops.

                Thanks anyways for the great help, at least I know it's possible (for future application) and learned something in the process.
                  • 3749
                  • 24,544 Posts
                  If you get curious, it often helps to look at the cached versions of the various objects (resource, chunk, snippet) in the core/cache directory.


                  ------------------------------------------------------------------------------------------
                  PLEASE, PLEASE specify the version of MODX you are using.
                  MODX info for everyone: http://bobsguides.com/modx.html
                    Did I help you? Buy me a beer
                    Get my Book: MODX:The Official Guide
                    MODX info for everyone: http://bobsguides.com/modx.html
                    My MODX Extras
                    Bob's Guides is now hosted at A2 MODX Hosting
                    • 31104
                    • 108 Posts
                    Great tip thanks Bob, I will.