SimPCoRe
 
Home
Installation

Working with Nodes



Advanced

Tutorial - Working with Nodes

Getting Children Nodes

Retrieving all Children Nodes from a Parent Node will return a NodeIterator:

<?php 
//populate test data
$node = $session->getRootNode();
$node = $node->addNode('users');
$node->addNode('jsmith');
$node->addNode('asmith');
$node->addNode('bsmith');
$node->addNode('csmith');

echo 'Getting children nodes for ' . $node->getPath() . '<br />';

$ni = $node->getNodes();

while ($ni->hasNext()) {
  $temporaryNode = $ni->nextNode();
  echo $temporaryNode->getPath() . ' is a child of ' . 
       $node->getPath() . '<br />';
}
?>
 

SimPCoRe
Home | Tutorials and Installation Instructions | Documentation | Download | Contact Us | Google Group