So, essentially you're trying to find "breadcrumbs" to your selection?
Maybe a function could be added to the tree helper. Like.. /// Usage in view: $tree->showCrumbs(99, 'Section/name', $data); /// New function in tree helper class: function showCrumbs($id, $name, $data) { /// .. something clever with a recursive use of php array_keys() function /// .. would have to track back to the parent returning the names and ids /// .. of the sections. Thoughts anyone? } On Dec 26, 10:35 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
Yes, there is a single table that references itself with a "parent_id" field. This is pratically identical to how it laid out in this example:http://bakery.cakephp.org/articles/view/63 On Dec 26, 5:08 pm, "phirschybar" <[EMAIL PROTECTED]> wrote: > Are all of the items in your hierarchy one type of data? In other > words, are they all in one table with an association of "has and > belongs to many"? > Ben > On Dec 26, 7:32 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > I have a situation where I know the id of a child, but I need the > > parental hierarchy. Using the structure in this (excellent) Bakery > > example, I have the following: > > 1. Art > > 1. Film > > 2. Music > > 1. Jazz > > 2. Pop > > 2. History > > 1. Archaeology > > 2. War > > 3. Science > > 1. Biology > > 2. Chemistry > > 3. Physics > > 4. Technology > > 1. Computing > > 1. Hardware > > 2. Software > > 2. Engineering > > In my situation, I know of "Hardware", but I need to know the > > following: > > 4. Technology > > 1. Computing > > 1. Hardware > > Or if I know of "Physics", I need to know: > > 3. Science > > 3. Physics > > Does anyone know how to accomplish this in a Cake-ish way (without > > hacking a bunch of queries together in my controller)? > > 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 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 -~----------~----~----~----~------~----~------~--~---