a work on process

More DB_NestedSet

You are reading a post by James Stewart entitled More DB_NestedSet. It was posted on 23 February 2005 at 3:16 pm.

You can find more posts by returning to the index.

Filed under: Snippets
Tagged: , ,

Daniel Khan, one of the maintainers of PEAR::DB_NestedSet jumped in and offered help after my last post on the subject of that package. It turned out there was a bug in the file Menu.php within the current version of NestedSet which is now fixed in CVS. Once that change was made it turned out there were still a few bugs in my code to be worked out.

With everything fixed I can now access menus as I would wish.

To retrieve all nodes: $data = $nestedSet->getAllNodes(true)

NestedSet supports multiple trees in one database table, each with their own parent. To retrieve all nodes within the tree that $id is a member of: $data = $nestedSet->getBranch($id, true);

And to get all the descendants of $id: $data = $nestedSet->getSubBranch($id,true);

It’s definitely making my menu handling much easier. I’m still working out how best to integrate functions to move and delete nodes with my admin tools and once I’m done I’ll try and write up a few examples here.

Recommend this post:

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Related Posts

 

No Comments »

No comments yet.

TrackBack URI

Leave a comment

Login Method

OpenID

Anonymous