That looks good, and you're right. However, I'm not an MPTT expert so it was obvious to use recursion. Now I'm heading towards a different problem since every ForumEntry belongsTo User, I get an array like this: http://bin.cakephp.org/view/723954878 which is impossible to work with. Any good ideas?
On Jul 2, 3:54 pm, AD7six <[EMAIL PROTECTED]> wrote: > On Jul 2, 11:49 am, Dan Soendergaard <[EMAIL PROTECTED]> wrote: > > > > > I'm doing a simple forum which should support nested replies. So, I > > decided to use the Tree Behavior. > > > models/forum_entry.php > > ----------------------------------------------------------------- > > <?php > > class ForumEntry extends ForumAppModel { > > > var $name = 'ForumEntry'; > > var $displayField = 'subject'; > > var $actsAs = array('Tree', 'Containable'); > > var $belongsTo = array('User'); > > > } > > > ?> > > ----------------------------------------------------------------- > > > The tree in my database looks like this: > > > - Testing > > --- ASubSubject > > ------ ASubSubSubject > > - Another Subject > > > How do I retrieve a node with parent_id = 0 (like "Testing" or > > "Another Subject") and all of its children while preserving the tree > > structure? > > > Using $this->ForumEntry->children($id) flattens the tree structure.. > > What's the point of using the tree behavior, and expecting it to give > you recursive data. > > http://bakery.cakephp.org/articles/view/tree-helper-1 --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---