Simple snippet (output filter) for MODX Revolution related items. Call as [[snippetname? &tpl=chunkname
&input=[[*your-comma-delimited-id-tv]]
]]
<?php
if ($input == null) { return 'No relevant items found.'; }
$tpl = $modx->getOption('tpl',$scriptProperties,null);
if (($tpl === null) || (!$modx->getChunk($tpl))) { return 'No template found'; }
$ids = explode (',', $input);
foreach ($ids as $a => $key) {
$document = $modx->getObject('modResource', array(
'published' => 1,
'id' => $key));
if ($document) {
$output[] = $modx->getChunk($tpl,$document->toArray());
}
}
return implode(', ',$output);
?>