API:getChildIds
From MODx Wiki
API Function Definition:
getChildIds
- Versions
- > 0.9.2 ?
- Return Values
- Success: id(s) of document's children
- Fail: empty array
- Data Type
- Array
- Object Hierarchy
- DocumentParser
Array getChildIds(mixed $id[, int $depth[, array $children]]);
- $id - the parent page to start from
- $depth - how many levels deep to search for children
- $children - ?
[edit]
Examples
Returns an array of child IDs belonging to the specified parent.
[edit]
Related Functions
[edit]
Function Source
$c= null; foreach ($this->documentMap as $mapEntry) { $childId= $mapEntry[$id]; if (!$childKey) { $childKey= "$childId"; } $c[$childKey]= $childId; } } $depth--; $children= $children + $c; } else { $children= $c; } if ($depth) { foreach ($c as $child) { $children= $children + $this->getChildIds($child, $depth, $children); } } } return $children; }
[edit]
