RE: [PHP] "Nested Set Model" or "modified preorder tree traversal" [SOLVED]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Since I couldn't find any short and sweet drop in code for this, I made my
own. Here it is in case anyone else finds it helpful. Should be pretty
straight forward. I use my own mysql wrapper functions, but you can pretty
much figure out what they do and S&R your own.

Hopefully this works as an attachement.

D.Vin

> -----Original Message-----
> From: Daevid Vincent [mailto:daevid@xxxxxxxxxx] 
> Sent: Wednesday, February 22, 2006 12:42 PM
> To: 'Curt Zirzow'; php-general@xxxxxxxxxxxxx
> Subject: RE: [PHP] "Nested Set Model" or "modified preorder 
> tree traversal"
> 
> Peter Brawley on the mySQL list pointed me at: 
> http://www.artfulsoftware.com/mysqlbook/sampler/mysqled1ch20.html 
> 
> Which uses mySQL 5's procedures and such.
> I haven't implemented this yet, but it appears to be what I 
> wanted for the
> most part.
> 
> > -----Original Message-----
> > From: Curt Zirzow [mailto:czirzow@xxxxxxxxx] 
> > Sent: Tuesday, February 21, 2006 10:58 PM
> > To: php-general@xxxxxxxxxxxxx
> > Subject: Re: [PHP] "Nested Set Model" or "modified preorder 
> > tree traversal"
> > 
> > On Tue, Feb 21, 2006 at 09:38:53PM -0800, Daevid Vincent wrote:
> > > I've been searching the web for the past few hours trying 
> > to find a simple
> > > drop-in class or functions to implement "Nested Set Model" 
> > or "modified
> > > preorder tree traversal".
> > 
> > I actually fell in love of this method of doing trees when I
> > discovered it about a year ago, when researching a fast way to do
> > a parent child retrieval.
> > 
> > > 
> > > I've found several tutorials and related links:
> > > 
> > >   
> > http://dev.mysql.com/tech-resources/articles/hierarchical-data.html
> > >   http://www.sitepoint.com/article/hierarchical-data-database
> > >  
> > > 
> > http://www.zend.com/zend/tut/tutorial-ferrara2.php?article=tut
> > orial-ferrara2
> > > &id=3453&open=1&anc=0&view=1
> > >   http://simon.incutio.com/archive/2003/06/19/storingTrees
> > >   http://istherelifeafter.com/joecelko.html
> > >   
> http://www.codeproject.com/cs/database/Trees_in_SQL_databases.asp
> > 
> > oh i have to add some of these to my list, i didn't have a couple
> > of them.
> > 
> > > 
> > > I even found some outdated PEAR DB_NestedSet class from 
> > 2003 that seemed way
> > > to overly complicated. And some other PHP4_Mysql3MPTTA 
> > class on PHP Classes
> > > that was equally complicated and written for ancient PHP4 
> > and mySQL 3!!
> > 
> > yeah, i kind of got that feeling with the PEAR class as well, i
> > think it was designed that way to be as flexible as possible. I'm
> > not familiar with the other class, i tend to avoid anything from
> > PHP Classes.
> > 
> > > 
> > > Hasn't anyone else done this before (recently)? 
> > > Did everyone just write their own code every time?
> > > Anyone have some easy to use code that allows for:
> > > Add, delete, update/rename, select, show tree, bread crumb 
> > display, etc.
> > 
> > It would be nice to have a tool to manage the functionality. There
> > will always be the issue with any common tool that is built for
> > this purpose is how do you relate the table that defines the nested
> > with the table that actually holds the data.
> > 
> > I believe that why the PEAR and other classes you came across
> > seemed to be overly complicated.  I have found that it is easier to
> > write my own management (as awful as that sounds) for the job at
> > hand.


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux