DB_NestedSet
| From: | James Stewart | Date: | Thu, 27 Jan 2005 15:00:34 +0000 |
| Subject: | DB_NestedSet | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-17208@lists.php.net to get a copy of this message | ||
Hi,
I've just signed up for the list but searched the archives yesterday for help with my issue and couldn't find what I was looking for...
I've just started exploring DB_NestedSet (using the latest beta) and I'm having some trouble working out how to get it to produce output for a particular branch. I have a database set up and scripts in place that produce a tree using the Menu output option when I use:
$data = $nestedSet->getAllNodes(true);
$params = array(
'structure' => $data,
'titleField' => 'name',
'urlField' => 'href');
$output =& DB_NestedSet_Output::factory($params, 'Menu');
$structure = $output->returnStructure();
print_r($structure);
but I can't work out how to get it to do the same for, say, all the children of the node with ID 2. I tried:
$data = $nestedSet->getSubBranch(2,true);
$params = array(
'structure' => $data,
'titleField' => 'name',
'urlField' => 'href');
$output =& DB_NestedSet_Output::factory($params, 'Menu');
$structure = $output->returnStructure();
print_r($structure);
but the only output I get from this is "Array ( )"
If anyone can provide me with any pointers I'd be very grateful.
thanks. James.
--
James Stewart : Freelance Web Developer
Work : http://jystewart.net
Play : http://james.anthropiccollective.org