We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28120
    • 380 Posts
    Are &parents and &resources mutually exclusive?

    On the attached tree if I run from resource 8 the following

    [[!getResources? &parents=`3` &resources=`4` &tpl=`gallery`]]

    it returns resources 4 and 6 and therefore ignores my parameter &resources=`4`

    However if I change it to

    [[!getResources? &parents=`1` &resources=`4` &tpl=`gallery`]]

    it correctly returns just resource 4

    Should I report this as a defect or is it a misunderstanding?

    Thanks

    Mark



      • 3749
      • 24,544 Posts
      I think &parents just shows the children of the named resource. Resource 1 has no children, so none are shown.

      It would be nice if getResources had a &showStart parameter that would make it show the parent itself as well.
        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
        • 28120
        • 380 Posts
        Actually that’s the opposite of what I was saying?

        Starting from &parents=`1` seemed to start it from the root of the site. (which I’m happy about)

        My point was that starting from a child e.g. &parents=`3` &resources=`4` seemed to confuse the query.
          • 22019
          • 390 Posts
          Sparkyhd - your initial conditions are not exclusive - in pseudo code - ’show children of resource 3 and include resource 4’. As 6 is also a child of resource 3, gR returns it.

          When you change it to &parents=1, then you get all the children of resource 1 (ie none), plus the resource you asked to be included regardless.

          If you want to specifically disregard 6, then you need to do &resources=`4,-6`.

          Or at least that is my understanding. It’s tempting to think of &resources to be a subset of &parents, but it isn’t (again, as far as I can tell through usage).
            Writer > E-consultant > MODx developer || Salesforce || modx 2.x || PHP 5.2.13 || MySQL client 5.0.86
            • 28120
            • 380 Posts
            Ok thanks - I misunderstood it.

            I thought &resources=`4` meant LIMIT to 4

            rather than

            include as well as anything else found under the parent.

            Thanks for putting me straight.
              • 12410
              • 353 Posts
              Hi Guys,
              How to I output just parents?

              [[!getResources? &tpl=`footer_links`]]


              Thanks
                • 9995
                • 1,613 Posts
                I think u need to use:
                &parents=`[[*id]]`
                  Evolution user, I like the back-end speed and simplicity smiley