Hey, ive been looking around for a bit and havnt found any really easy way to do this without doing things in what i think is a very ugly way so hopefully the community has some thoughts or answers on the subject.
Whenever a snippet or chunk is called the variables present are always in reference to the current resource that is being accessed during the request, what im looking to do is create a snippet that will call and render a chunk in the context of a different resource. Example:
Snippit Code:
<?php
$items = $modx->getCollection('modResource', array('parent' => $modx->documentIdentifier));
$output = array();
foreach ($items as $item)
{
$output[] = $modx->getChunk('mychunk'); // <-- something i need to do here im hoping
}
return implode("<br>", $output);
’mychunk’ Chunk Code:
I would like this code to then output a list of the ids and titles for all of the child resources of the current document. But what i get instead is just the current document over and over again. Any ideas? (Ideally without parsing the variables myself in the chunk)