Go to the API and checkout the Model::findAllThreaded() method. It does exactly what you are looking for.
In your controller, you should be able to replace findAll with findAllThreaded. findAllThreaded will look for a parent_id field, if it finds one, child objects (sub-menus in your case) will be put in a separate array named "children". Use the debug output to see how the data is structured. sc On Nov 19, 8:30 am, "voriux" <[EMAIL PROTECTED]> wrote: > Hi people, > > I would like to ask a noob question how to model this situation? > > I have table: > menu > (id pri_key int(5), > name varchar(200), > parent_id int(5)) > > Data looks like this: > > 1,Home,0 > 2,Pages,0 > 3,First Page,2 > 4,Second Page,2 > 5,Contacts,0 > > I would like to get recursion results, like this > > Home > Pages > - First Page > - Second Page > Contacts > > Any opinions? Thanks in advance :) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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 -~----------~----~----~----~------~----~------~--~---
