I suppose I need to add 'lft' and 'rght' fields to my database but how
do I calculate these values? I never heard of MPTT before and I think
I understand the basics after reading an article about it (http://
articles.sitepoint.com/article/hierarchical-data-database/2), but I
can't really think of an algorythm that would update an existing
database table when only the parent info is available...

Any pointers?

Can I use the CakePHP tree functionality with just the parent_id info
(I'd guess not?) ?


thanks and best regards,
Marv

On Sep 23, 8:02 pm, cricket <[email protected]> wrote:
> On Thu, Sep 23, 2010 at 8:59 AM, marvelade <[email protected]> wrote:
> > Dear all
>
> > For a documentation system we have a tree structure of key words (came
> > from an excel file).
>
> > it's now in a MySQL table with the following columns (field names are
> > pretty self-explanatory)
>
> > CREATE TABLE IF NOT EXISTS `keywords` (
> > `id` smallint(5) unsigned NOT NULL auto_increment,
> > `parent_id` int(10) unsigned default NULL,
> > `keyword` varchar(64) collate utf8_unicode_ci NOT NULL,
> > `approved` tinyint(1) NOT NULL default '0',
> > PRIMARY KEY (`id`)
> > )
>
> > keywords at root level have parent_id NULL.
>
> > I want to have a system so each keyword can display its chain of
> > parents up to the root level
>
> > For example I have this chain:
> > "Nature sciences" -> "chemistry" -> "analysis methods" -> "gas
> > analysis"
>
> > When I view keyword "gas analysis" I want my code to display:
>
> > Parent chain : "Nature sciences" -> "chemistry" -> "analysis methods"
>
> > When I follow the procedure as described here:
> >http://bakery.cakephp.org/articles/view/threaded-lists
>
> > I can't get it to work. I keep getting the error:
>
> > 1064: You have an error in your SQL syntax; check the manual that
> > corresponds to your MySQL server version for the right syntax to use
> > near 'findAllThreaded' at line 1
>
> > For some reason the function name findAllThreaded is passed as a SQL
> > statement :s
>
> > Can anyone please advise? I use CakePHP 1.3
>
> That's because the method no longer exists, so Cake simply passes the
> request directly to the DB. There have been significant changes to the
> Cake libs since that article was posted. Use find('threaded') instead.
> Also, check out TreeBehavior:
>
> http://book.cakephp.org/view/91/Tree

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to