Question

I want to use getResources to get the content from a document, and its child documents. I believe I can used &depth to do this but I cannot seem to get it working.

I have tried 2 approaches:

echo "[[!getResources?  $parents=`15`  &includeTVs=`1` &resources=`" . $resid . "` &depth=`1` &tpl=`tendertmp`]]";

and:

echo "[[!getResources? $parents=`" . $resid . "` &depth=`1` &includeTVs=`1` &tpl=`tendertmp`]]";

$resid is just a number generated by a snippet - the first example works fine without depth.

Would anyone know the correct way of using depth or a way to get the reources content along with its child resources content?

Was it helpful?

Solution

Why you do not use http://rtfm.modx.com/display/revolution20/modX.runSnippet ?

$output = $modx->runSnippet('getResources',array(
   'parents' => $resid,
   'depth' => '1',
   'includeTVs' => '1',
   'tpl' => 'tendertmp'
));
echo $output;

and your second mistake in $parents instead &parents.

OTHER TIPS

I actually do not understand why you are attempting to run getResources from within a PHP Snippet. There is very little reason to do so.

You could simple do a $modx->getCollection('modResource, $someCriteriaHere); or

Call getResources directly from your pages:

[[!getResources?parents=`15`&includeTVs=`1`&depth=`1`&tpl=`tendertmp`]]
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top