We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36830
    • 140 Posts
    If i have a parent returning children with a getresources call how can i also pull resources that are children of other parents but are tagged with the same parent name? I figure there must be a better method than calling both getresources and getresourcestag... Or should I replace getresources with getresourestag in all instances and essentially obviate the parent/child structure and require client to always tag resources...? Thanks for any suggestions.
      • 3749
      • 24,544 Posts
      There is the tree structure, and there are tags. I can't think of any easy way to mix them. Even in a custom snippet that retrieved both, I think you'd need a custom sort routine if you want to order them in any way.

      If you don't care about the order, a custom snippet might not be that bad. It's just a matter of retrieving the resources, then looping through them using something like this:

      $tpl = $scriptProperties['tpl'];
      
      foreach ($docs as $doc) {
         $fields = $doc->toArray();
         $output .= $modx->getChunk($tpl, $fields);
      }


      Of course that won't give you all the formatting features you get with getResources().
        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