Can anyone see why this snippet stopped working?
After update to 1.0.14 I see the message: "No documents found"
Is it because of an update of ditto/ultimateparent or smt?
<?php
/* hierarchy_based_chunk
[!banner?
&parent_ids=`1,2,3`
&chunk_names=`banner_chunk1,banner_chunk2,banner_chunk3`
&def_chunk_name=`banner_main`
!]
the above snippet call in a template produces:
hbc_1 chunk on doc 2 and all children/grandchildren
hbc_2 chunk on doc 21 and all its children/grandchildren
hbc_def chunk on all other documents
*/
// set the default ids of the top level parent containers
$default_parent_ids = array();
// set the default names of the chunks to display
// based on the same order as the $parent_ids
$default_chunk_names = array();
// set the overall default chunk name
$default_chunk_name = isset($def_chunk_name) ? $def_chunk_name : '';
// ===== end setup ===== //
$parent_ids = isset($parent_ids) ? explode(',',$parent_ids) : $default_parent_ids;
$chunk_names = isset($chunk_names) ? explode(',',$chunk_names) : $default_chunk_names;
if(count($parent_ids) > 0 && count($chunk_names) > 0){
$uparent = $modx->runSnippet('UltimateParent');
$check_array = array($modx->documentObject['id'],$modx->documentObject['parent'],$uparent);
for($x=0; $x < count($parent_ids); $x++){
if(in_array($parent_ids[$x],$check_array)){
$print_chunk = $chunk_names[$x];
}
}
// if $print_chunk is empty set to overall default
if($print_chunk ==''){
$print_chunk = $default_chunk_name;
}
}
return $modx->getChunk($print_chunk);
?>
[ed. note: fourroses666 last edited this post 12 years, 3 months ago.]
Evolution user, I like the back-end speed and simplicity

-
☆ A M B ☆
- 2,213 Posts
What version of Evolution did you upgrade from?
Hmm, I'm not sure, I think 1.0.8.
after next week I can see what it was, at the office this is written down but I'm on vacation now
Evolution user, I like the back-end speed and simplicity

hmm, log is empty, call is in a chunk, the array gives the same result, normal dittocall works.
i have no idea whats going on.
Evolution user, I like the back-end speed and simplicity

I agree with trying the solution presented by jacko, back when this snippet was created ultimateparent always defaulted to current document and somewhere along the line it changed.