MODx - MIGx - mh.parseMIGXToGallery (parse migx json)
<?php
/*
mh.parseMIGXToGallery (snippet used with migx)
by Marc Hamstra
source: https://www.markhamstra.com/modx-blog/2012/04/managing-galleries-with-migx/
[[mh.parseMIGXToGallery?
&tpl=`mh.images.gallery.tpl`
&input=`[[*mh.images]]`
&set=`name of the set`
]]
*/
$input = $modx->fromJSON($input);
$output = array();
if (!$input || empty($tpl)) return 'no stuff';
foreach ($input as $row) {
if (isset($set) && !empty($set) && ($set != $row['set'])) continue;
$output[] = $modx->getChunk($tpl, $row);
}
return implode("\n", $output);