First off, you are calling the chunk too late in my opinion.
If you check some complex ready made extra like getResources, basicly they work like this (from one of my snippets)
$products = $modx->getCollection('vcProduct', $query);
foreach($products as $product) {
$vars = $product->toArray();
$out[] = $modx->getChunk($rowTpl, $vars);
}
return implode("\n", $out);
Each rown gets called separately, and then I return the output to template with that. Got ul in the template and that chunk is list items pretty much.
instead of returning it, you can set it as placeholder to template with
$modx->toPlaceHolder('placeHolderName' , implode("\n", $out); in my case
After this, you call the snippet first in the template with [[!yourSnippet]] (you can call it also cached without using the ! in the call). Then you can put your placeholder [[+placeHolderName]] there.
code example
[[!YourSnippet]]
[[+placeHolderName]]
I am not sure how multidimensional arrays work for place holders, if I recall right you might need to call $modx->toPlaceHolders()
http://rtfm.modx.com/display/revolution20/modX.toPlaceholders.
Sorry, bit lagged from odd day behind. My php seems to run on bit slow
[ed. note: lazylegs last edited this post 15 years, 1 month ago.]