$data = $this->Category->children(1, true, null);

$categories = Set::combine($data, '{n}.Category.id', '{n}.Category.title  );

$this->set( 'categories', $categories );

HTH,
- Dardo Sordi.

On Tue, Jun 3, 2008 at 11:08 PM, ReiToei <[EMAIL PROTECTED]> wrote:
>
> Hi,
> Pretty new to 1.2 but I'm having some trouble understanding how to get
> my tree child data into a select... I've followed the tutorial:
> http://book.cakephp.org/view/91/tree-behavior and set up my
> categories.
>
> In my categories controller (in a function named 'test') I'm using
> this function to return a list of child nodes from my root category:
> $categories = $this->Category->children(1, true, null);
>
> which returns the data I expect, a series of chilld nodes in array
> format as follows:
>
> Array
> (
>    [0] => Array
>        (
>            [Category] => Array
>                (
>                    [id] => 2
>                    [parent_id] => 1
>                    [lft] => 2
>                    [rght] => 7
>                    [title] => Fun
>                )
>
>        )
>
>    [1] => Array
>        (
>            [Category] => Array
>                (
>                    [id] => 3
>                    [parent_id] => 1
>                    [lft] => 8
>                    [rght] => 15
>                    [title] => Work
>                )
>
>        )
>
> )
>
> I want to build a dropdown box in my view based on this data, [id] and
> [title]... how would I go about doing this? I know I should probably
> use find->('list' but I just don't know how to 'plug' the two
> together. Any help would be greatly appreciated.
> Thanks,
> Paul
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to