Friday, September 24, 2010

Re: tree structure problem

the more I get to know PHP, the more I need to write recursive
functions... :)

I'll try to come up with something and post my findings.


grtz,
Marv


On Sep 24, 7:45 pm, cricket <zijn.digi...@gmail.com> wrote:
> On Fri, Sep 24, 2010 at 11:49 AM, marvelade <marvel...@gmail.com> wrote:
>
> > 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?
>
> I once tackled that very problem but wasn't successful. I still think
> it must be possible to write a script to do it but, in the end, I just
> created a text file and totted through it "by hand". I did search
> online and, I believe, posted a query to this list, but couldn't find
> anything.
>
> > Can I use the CakePHP tree functionality with just the parent_id info
> > (I'd guess not?) ?
>
> I'm not sure. I suspect not. It seems to me, though, that MPTT would
> be the way to go for what you're doing.
>
> BTW, do check out this article:http://bakery.cakephp.org/articles/view/tree-helper-1
>
> It's a little bit confusing but it's definitely useful. I think it'd
> suit your situation. Let me know if you need some pointers.

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 cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: