Thank you very much majna! I made it with a recursive function like that, now it's ok.
On 21 Ago, 10:55, majna <majna...@gmail.com> wrote: > Use recursion like thishttp://bakery.cakephp.org/articles/view/threaded-lists > > On Aug 21, 10:41 am, albe <radialremo...@gmail.com> wrote: > > > Hi everybody, > > > Thanks to the function findAllThreaded() I've obtained a structure > > like this: > > > Array > > ( > > [0] => Array > > ( > > [Post] => Array > > ( > > [id] => 55 > > [parent_id] => 53 > > [title] => ... > > [body] => ... > > [user_id] => 1 > > [forum_id] => 1 > > ) > > > [Forum] => Array > > ( > > [id] => 1 > > [title] => ... > > ) > > > [User] => Array > > ( > > [id] => 1 > > [username] => ... > > ) > > > [children] => Array > > ( > > [0] => Array > > ( > > [Post] => Array > > ( > > [id] => 58 > > [parent_id] => 55 > > [title] => > > [body] => ... > > [user_id] => 2 > > [forum_id] => 1 > > ) > > > [Forum] => Array > > ( > > [id] => 1 > > [title] => ... > > ) > > > [User] => Array > > ( > > [id] => 2 > > [username] => ... > > ) > > > [children] => Array > > ( > > ) > > > ) > > > ) > > ) > > ) > > > If I try to do a foreach cycle over this structure in this way: > > > foreach ($posts as $p) { ... } > > > I discover that the cycle considers only the first post (it doesn't > > consider the child). Which cycle am I supposed to do to consider every > > item (child, children of the child... and so on)? > > Thanks in advance! --~--~---------~--~----~------------~-------~--~----~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---