We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10669
    • 8 Posts
    Okay, this is really getting to me. I want to call up one resource by its id and I can’t work it out.

    Logically I thought this would work:
    [[getResources? &parents=`5` &resources=`265` &tpl=`template_links` &includeContent=`1` &includeTVs=`1` &limit=`1`]]
    However, it bring up the most recent resource in 5.

    So I thought I would try this:
    [[getResources? &parents=`5` &resources=`265` &tpl=`template_links` &includeContent=`1` &includeTVs=`1` &where=’{"id:=":265}’ &limit=`1`]]
    By adding the &where call, but it still brings up the most recent resource in 5.

    I thought, like in Ditto I could retrieve a specific resource by its id, however, it appears not.

    Any ideas?
      • 33968
      • 863 Posts
      Well currently you are asking gR to list resources with parent of ’5’, as well as return resource number 265.

      But you’ve set the limit to 1 so only the first resource found will be displayed.

      Try removing the &parents=`5` property:
      [[getResources? &resources=`265` &tpl=`template_links` &includeContent=`1` &includeTVs=`1`]]
      
        • 36318
        • 1 Posts
        Hi,

        I`ve some sort of the same problem. I Will display a specific Resource (we call it: 7)

        When I call:

        [[getResources? &resources=`7` &tpl=`boxInhalt` &includeContent=`1` &includeTVs=`1`]]


        the output shows up 4 Resources (10,9,8,7)

        Please where`s the fault???
          • 22303 MODX Staff
          • 10,725 Posts
          Set &parents=`-1` — you are including all children of the current Resource (plus your specific Resource specified in &resources) by not specifying a &parents value.
            • 33968
            • 863 Posts
            Jason - could we perhaps add that to the docs?

            Currently there is no default value indicated for parents, although what you said above indicates otherwise.

            Luke
              • 10669
              • 8 Posts
              Thanks Jason, the &parents=`-1` worked fine. Definitely put it into the documentation, as there is nothing there about this and I would think it would be a common occurrence.
                • 8109
                • 128 Posts
                I beleive the default parent is the current resource (as indicated in the docs) http://rtfm.modx.com/display/ADDON/getResources.
                  Revo 2.0.8-pl
                  • 33968
                  • 863 Posts
                  @drwagner13: Jason has kindly updated the docs since then, it's all clear now wink