getChildIds
API Quick reference
Variable name: | getChildIds |
CMS versions: | 0.9.x + Evo |
Variable type: | array |
Object parent: |
API:getChildIds
Description
Array getChildIds(mixed $id[, int $depth[, array $children]]);
Returns an array of child IDs belonging to the specified parent.
- $id - the parent page to start from
- $depth - how many levels deep to search for children
- $children - if you already have an array of child ids, give it to the method, and new values will be added
Contains the document Listing (tree) like the sitemap
Related
See also, this page on Understanding the Document Object
Function Source
function getChildIds($id, $depth= 10, $children= array ()) { $c= null; foreach ($this->documentMap as $mapEntry) { if (isset ($mapEntry[$id])) { $childId= $mapEntry[$id]; $childKey= array_search($childId, $this->documentListing); if (!$childKey) { $childKey= "$childId"; } $c[$childKey]= $childId; } } $depth--; if (is_array($c)) { if (is_array($children)) { $children= $children + $c; } else { $children= $c; } if ($depth) { foreach ($c as $child) { $children= $children + $this->getChildIds($child, $depth, $children); } } } return $children; }
Suggest an edit to this page.