Quote from: treigh at Jan 26, 2010, 02:19 PM
I’d like to dynamically retrieve the content of a MODx Revo document into another one and I understand that the GetResources snippet is designed to do just that like the GetField does on Evo.
getResources is for summarizing Resources, similar to Ditto.
If all you want to do is get a field from an object in the MODx core, try a simple snippet like this, which I call getValue:
<?php
$value = '';
if ($object = $modx->getObject($class, $modx->fromJSON($where))) {
$value = $object->get($field);
}
return $value;
?>
You could then call this with a variety of arguments to get a piece of MODx data. To get the content of the Resource with id 12:
[[getValue? &class=`modResource` &field=`content` &where=`{"id":12}`]]
To get the username of the User with based on the current Resource’s editedby value:
[[getValue? &class=`modUser` &field=`username` &where=`{"id":[[*editedby]]}`]]