We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 43812
    • 2 Posts
    I am trying to get the published children of a specific document. Sounds pretty simple, but I just can't get the syntax correct. This is what I have:

    $criteria = $modx->newQuery('modResource');
    $criteria->where(array(
    'parent=1',
    'published' => true,
    ));
    $criteria->sortby('menuindex','ASC');
    $columns = $modx->resource->getMany('Children',$criteria);

    Anytime I add the "published" option to $criteria, it crashes. Please help!
      • 4172
      • 5,888 Posts
      try this:

      <?php
      
      $criteria = $modx->newQuery('modResource');
      $criteria->where(array(
      'parent' => 1,
      'published' => 1
      ));
      $criteria->sortby('menuindex','ASC');
      $columns = $modx->resource->getMany('Children',$criteria);
      
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!