We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22347 ☆ A M B ☆
    • 29 Posts
    Here is my situation...

    Context A - Document 1
    Have call in document 1:
    [[!getResources? &tpl=`newsTPL` &context=`B` &parents=`2` &limit=`1` &depth=`5` &includeContent=`1` &includeTVs=`1` &processTVs=`1` &showHidden=`1` &hideContainers=`1` &sortby=`publishedon` &sortdir=`DESC` &cache=`0`]]

    Context B - Document 2 is a container. Has Document 3,4 as Sub Containers. Document 3,4 containers have published documents in them.

    When the call above in Doc 1 is referring to parents 2... it brings back 0 results. If I put a document in Doc 2 container, it will show up. If I change the getResource call to 3 or 4, it will bring back the results of that container.

    The issue is that it is not able to grab documents from child containers. Does this make sense? If you need further details, please let me know. Using latest version of getResources1.0.4
      "Give a company a website, and they will be successful for now...
      Give a company a long-term web strategy, and they will be successful for a lifetime."

      Company Website: http://www.orbitalalliance.com
      Company Blog: http://www.orbitalalliance.com/blog
      • 26575
      • 57 Posts
      On my current project it also works fine. No idea why...
      (MODX 2.1.3. pl)
        christian seel - www.christianseel.com
        web developer & designer at chsmedien.de
        twitter: @christianseel / @chsmedien
        • 40045
        • 534 Posts
        I also have issues with getResources (1.4.0pl, modx revo 2.1.1) and multiple contexts (I use Babel for multilanguage). What I wanted to do is using a single news-sidebar-widget for both languages.

        This widget has a getResources call in it with &parents=`5,11` while parent 5 is in context A and parent 11 is in context B. I didn't specify the &context=`` parameter because in the docs it says when not specified the current context is used (while the extras page says if &context is not specified, all context are used...what is right?). I thought, if the current context is used, perfect, that would mean the other context is ignored, but that doesn't seem to be the case.

        So what I want is that getResources looks at the context the visitor is in (ie. web or en -> languages) and then only search the parents that are in this context, and not on the other one too...

        this would mean that I would have to dynamically change the &context=`` parameter in the getResources call, isn't it? Because when I specify &context=`web,en` both are searched but only one should be searched, when I only specify one, only this one is searched...

        so what I did for now is create a very simple snippet called getContext which does return the actual context key with

        return $modx->context->get('key');


        and inserted this in the in the &context=`` parameter like this...

        &context=`[[!getContext]]`


        it works as expected and the problem is solved that way, but I just can't believe that I had to make this snippet, is it really not possible to only search the context the getResources snippets gets called in or did I just miss some important detail? Couldn't this easily be added?

        Thanks for your reply!