I have this snippet :
<?php
$list = $modx->runSnippet('getResources', array(
'parents'=>'16',
'depth'=>'1',
'includeContent'=>'1',
'limit'=>'1'
));
$output = explode(',', $list);
//print_r($list);
foreach($output as $i) {
//echo $i;
foreach($i as $key => $value) {
echo $key.' : '.$value.'<br />';
}
}
With print_r I can see the array 😉
But using the foreach loop… nothing print !
Thanks for your help…
The problem might be that you are calling ‘explode’ on an array when it should be taking a string.
Not sure exactly what your $list array looks like, but perhaps try this instead:
EDIT
Have tested this and $list is not an array but a pre-formatted string meant for debugging:
I’m not sure exactly what you want to achieve, but it’s usually better to use the tpl parameter to format results using a Chunk.
getResources is designed for listing Resources for front end display and is not generally used to retrieve raw data.