We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 41870
    • 16 Posts
    As a complete beginner in MODX Revolution I followed this excellent tutorial at http://codingpad.maryspad.com/2011/04/11/modx-revolution-for-complete-beginners-part-10-using-getresources-to-aggregate-content/. From there I understand that inserting this bit of code
    [[!getResources]]
    anywhere in your template (or chunk) would output a PHP array with available fields of a resource (which one would it be?) And that inserting a code
    [[!getResources:default=`No results`]]
    , and getting a response 'No results' would mean that there's nothing wrong with the snippet installation.

    In first case I get nothing at all, and in second case I get 'No results'. Am I missing something?

    (I understand that in order to get meaningful response I need more parameters and to format the template chunk etc, but doing that still gives me 'No response', and I'd like to debug if there's something wrong.)

    Again sorry if it'd not a smart question, and many thanks for any help.
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      getResources lists the resources that are children of a specified resource - &parents=`2` would list all the children of resource #2. I believe that if you don't specify a "parents" property, it will use the current resource as the default parent. So if the resource you put the getResources snippet on has no children, there's nothing for it to list.
        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
        • 42046
        • 436 Posts
        Are you including a template chunk

        [[!getResources?
        &parents=`[[*id]]`
        &tpl=`myRowTpl`
        ]]
        ?
          • 41870
          • 16 Posts
          Quote from: sottwell at Aug 02, 2013, 01:08 PM
          getResources lists the resources that are children of a specified resource - &parents=`2` would list all the children of resource #2. I believe that if you don't specify a "parents" property, it will use the current resource as the default parent. So if the resource you put the getResources snippet on has no children, there's nothing for it to list.

          Thank You sottwell, using
          [[!getResources? &parents=`3` &resources=`1`]]
          got me the array at last, so I can move on from there. So the (otherwise excellent) tutorial I mentioned had this little misleading bit.

          And thanks Dan, I'll include chunk in a minute and am sure it'll work this time.
            • 41870
            • 16 Posts
            Quote from: absent42 at Aug 02, 2013, 01:08 PM
            Are you including a template chunk

            [[!getResources?
            &parents=`[[*id]]`
            &tpl=`myRowTpl`
            ]]
            ?

            Thank you Dan, it works now. One more question if I may (can't find it quick enough): how to get the resource content?
            [[!getResources? &parents=`3` &resources=`4` &tpl=`contentoutput`]]
            + (in contentoutput)
            <p>[[+introtext]]</p>
            gives me Summary (introtext) field, but
            <p>[[+content]]</p>
            does not give content. Sorry if I'm pushing it, but you've been so helpful. It's a great forum.
              • 41870
              • 16 Posts
              Sorry, I was missing the
               &includeContent=`1`
              parameter. This really was stupid of me, and sorry for asking
                • 41870
                • 16 Posts
                Sorry, I was missing the
                 &includeContent=`1`
                parameter. This really was stupid of me, and sorry for asking