I've got a problem with modx evo (1.0.15). I wanna get resource by id in my snippet. Snippet call looks like this:
[[byid? &id=`3`]]
and proccessing looks like this:
$name = 'modResource';
$criteria = array('id' => $id);
$document = $modx->getObject($name,$criteria);
print_r (var_dump($docArray));
I tried this
$resource = $modx->getObject('modResource', $id);
and this
$resource = $modx->getObject('modResource', 3);
all these variants gave me NULL. What am I doing wrong?
1.0.15 is modx evolution. You need to call like following.
$resource = $modx->getDocumentObject('id',3);
You can get more information in evolution specific docs. http://wiki.modxcms.com/index.php/API:getDocumentObject