Hallo ModX-Community,
after updating from revolution 2.0.8 to 2.1.1 I get an error for a self created snippet (snippet name: "getChild"):
Fatal error: Call to undefined method modX::getAllChildren() in /core/cache/includes/elements/modsnippet/17.include.cache.php on line 10
This is my "getChild" snippet:
<?php
$id = $modx->runSnippet("UltimateParent");
if ($id == 4 || $id == 6 ) {
$children= $modx->getAllChildren($id, ’menuindex’, ’ASC’, ’pagetitle, parent, alias, content, id’);
if (!$children === false) {
foreach($children as $child)
{
$output .= ’:or:is=`’.$child[’id’].’`’;
}
}
return $output;
}
After some search I have found at the "Summary of Legacy Code Removed in 2.1"
http://rtfm.modx.com/display/revolution20/Summary+of+Legacy+Code+Removed+in+2.1 that the Method: modX->getAllChildren() is removed in Revolution 2.1. The replacement or potential workaround is: modX->getCollection(’modResource’, $criteria) , $criteria having where condition ’parent’ = $id
I have created the "getChild" snippet to load the Javascript for a slideshow only at ID=4 or ID=6.
Here is the chunk (named: Scripts), which implements the JS-Code to the header:
[[*id:is=`1`[[getChild?]]:then=`<script src="js/jquery.1.4.2.min.js" type="text/javascript"></script>
<script src="js/jquery.cycle.min.js" type="text/javascript"></script>
<script type="text/javascript">
[[*id:is=`1`:then=`[[$CycleSlideshow]]`:else=`[[$CycleImageViewer]]`]]
</script>`:else=``]]
But now to my question: How can I change my snippet with the replaced method?
Or is there a better solution to load the Slideshow-Javascript only at id= 4 and 6?
Many thanks in advance!
best regards
flo