We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 23052
    • 3 Posts
    Hi everyone,

    I’m quite new to MODx but have really been enjoying using it so far.

    I’m trying to use getResources to list the resources on a site, but I can’t seem to get it to include the Containers in the output.

    My getResources call is as follows:

    [[!getResources<br />  &tpl=`tagResult`<br />  &includeContent=`1`<br />  &includeTVs=`1`<br />  &showHidden=`1`<br />  &limit=’20’<br />  &depth=’20’<br />  &element=`getResources`<br />  &elementClass=`modSnippet`<br />  &hideContainers=`0`<br />  &resources =`1,2,3,4`<br />]]


    I’ve set hideContainers to 0, but the output still doesn’t include the containers. I’ve had a look through the Wiki entry and looked on Google for a while but I can’t seem to find an answer/solution to this.

    I’d be grateful for any help!
      • 3749
      • 24,544 Posts
      Are you sure that the container resources have the "Container" checkbox checked on the Page Settings tab? In Revo, it’s independent of whether they have children and they look like containers in the tree whether it’s checked or not. I think getResources looks at that checkbox.

        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
        • 23052
        • 3 Posts
        The Container checkbox is definitely ticked, but it still won’t show them on the output. Anything else I should check?
          • 23052
          • 3 Posts
          Solved it - it was nothing to do with the containers, just the fact that I didn’t include ’0’ in the &parents, and so it was never looking for the Containers in the first place.

          Slightly misleading - maybe the ’web’ resource at the top should say ’web (0)’, so we know to include it for these things?