the first two and the last should work, the third not.
what is your whole snippet-call?
What you have to do is the following thing.
Create a snippet "getResourcesTree" with the following code:
<?php
if (!function_exists('multiarray_keys')) {
function multiarray_keys($ar) {
foreach ($ar as $k => $v) {
$keys[] = $k;
if (is_array($ar[$k]))
$keys = array_merge($keys, multiarray_keys($ar[$k]));
}
return $keys;
}
}
$parents = (!empty($parents) || $parents === '0') ? explode(',', $parents) : array($modx->resource->get('id'));
$depth = isset($depth) ? (integer) $depth : 10;
$tree = $modx->getTree($parents, $depth);
$tree = multiarray_keys($tree);
$tree = implode(',', $tree);
$tree = 'FIELD(modResource.id, ' . $tree . ')';
return $tree;
And now your getResources call
[[!getResources?
&parents=`19,25`
&tpl=`myTpl`
&sortdir=`ASC`
&limit=`50`
&sortby=`[[!getResourcesTree? &parents=`19,25` &depth=`100`]]
`]]
The reason why it is not working what you wanted is that the menuindex for each level starts with a zero. So the first results are the first resrouces of all the levels.