Give this a try:
<?php
$output ='';
while ($row = mysql_fetch_array($resultmain )) {
$output .= $modx->runSnippet("Ditto", array(
'parents' => '134',
'documents' => $row['id'],
'tpl' => 'usedtempchunk'));
}
return $output;
?>
I think you can collect the ids and run ditto once:
$ids = array();
while ($row = mysql_fetch_array($resultmain )) {
$ids[] = $row['id'];
}
return $modx->runSnippet("Ditto", array(
'documents' => implode(',',$ids),
'tpl' => 'usedtempchunk'));
Thanks guys - turns out it was happy if I added double braces: [[!Ditto....