Hi TIA,
I'm no expert in these things, but as a few guesses on things to try:
1) O/S Security: Check to see if the user running the script has access to those folder. To test this, try echoing MODX_CORE_PATH
2) Site Security: if your web site has security running on it, latestPostsTpl might only be available to certain users. According to your script, you're running as an anonymous user
Hope this helps,
Tom
you may need to set the &context-property or/and a $modx->resource - object before calling getResources.
Can't you put this snippet-call on a Resource with an empty-template and call its url?
Definitely echo core path to make sure MODX is instantiated correctly. Likely do need to pass in context to getResources but if that still doesn't work I would suggest using a xPDO where query rather than getResources
jpdevries
Sinbad, see if adding this helps:
$modx->getRequest();
$homeId = $modx->getOption('site_start');
$homeResource = $modx->getObject('modResource', $homeId);
if ($homeResource instanceof modResource) {
$modx->resource = $homeResource;
} else {
echo "\nNo Resource\n";
}
$id = 1; // some user's ID
$user = $modx->getObject('modUser', $id);
$modx->user = $user;