Home > Archive > PHP Pear > January 2005 > DB_NestedSet
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| James Stewart 2005-01-27, 4:00 pm |
| 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
| |
| Daniel Khan 2005-01-31, 8:57 pm |
| Hello James,
James Stewart wrote:
[..]
> 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:
[..]
> but the only output I get from this is "Array ( )"
>
> If anyone can provide me with any pointers I'd be very grateful.
Right - the output driver seems to demand a root node as starting point.
I haven't looked into this code for some time but I will try to fix this
with the next relase.
GetBranch will work btw.
Greetings
--
Daniel Khan
|
|
|
|
|