We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • Hi all,
    I think these days I’m diving much in MODx, and so I’ve posted many questions here. I hope that I’ll learn some from you all awesome members here.
    I’m using getResources and @EVAL binding to return the related posts TV.
    @EVAL return $modx->runSnippet('getResources', array('parents' => '1,2,3,4,5', 'depth' => 3, 'limit' => 0, 'outputSeparator' => '||','includeContent' => 1, 'showHidden' => '1',  'context' => 'web', 'tpl' => 'taf.relatePostTV' ,'includeTVs'=> 0,'hideContainers' => 1));
    


    My problem is that I want to show all posts which arent containers. I leave the parents to 0 and it doesnt show up anything in my TV. If I change the hideContainers to 0, it does show my first level on resources list.

    Can anyone help me with this, with simple lines of code or just using the getResources way?

    Thanks in advanced.
      • 3749
      • 24,544 Posts
      Instead of $hideContainers, try this:
      &where=`{"container:=":0}`

        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
      • And if I use @EVAL binding, is this right?
        @EVAL return $modx->runSnippet('getResources', array('parents' => '0', 'depth' => 3, 'limit' => 0, 'outputSeparator' => '||','includeContent' => 1, 'showHidden' => '1',  'context' => 'web', 'tpl' => 'taf.relatePostTV' ,'includeTVs'=> 0,'where' => '{"container:=":0}'));
          • 3749
          • 24,544 Posts
          Quote from: xgenvn at Aug 09, 2011, 04:43 AM

          And if I use @EVAL binding, is this right?
          @EVAL return $modx->runSnippet('getResources', array('parents' => '0', 'depth' => 3, 'limit' => 0, 'outputSeparator' => '||','includeContent' => 1, 'showHidden' => '1',  'context' => 'web', 'tpl' => 'taf.relatePostTV' ,'includeTVs'=> 0,'where' => '{"container:=":0}'));


          It should be, but I would try it with just a getResources tag first, then as a snippet as you’ve written it, then in the TV.

            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
          • I’ll test it and post my results soon. Thanks Bob, you’re great.