I'm getting the page with ID 3. This page has 3 subpages. So, on the page with ID 3 I call a snippet to get the subpages like this:
$c = $modx->newQuery('modResource');
$c->leftJoin('modTemplateVarResource', 'TV1', array('TV1.contentid = modResource.id'));
$c->leftJoin('modTemplateVar', 'TV2', 'TV1.id = TV1.tmplvarid AND TV1.`value` = "XXX"');
$c->where(array(
'parent' => 3,
'deleted' => false,
'published' => true,
'TV1.value' => 'YYY'
));
$c->limit($limit);
$c->prepare();
$output = "";
$resources = $modx->getCollection('modResource', $c);
foreach ($resources as $resource) {
$resourceArray = $resource->toArray();
$output .= $modx->getChunk($tpl, $resourceArray);
}
return $output;
So, when I use get chunk I cannot access the Template Variabel with [[*MyVar]]
. Did i have to tell the getCollection to grab them? Or did I have to make a new query to grab the Template Vars and give it to the properties in getChunk two?
Greetings