tags:

views:

99

answers:

2

How to create select/option html tag from find('threaded') data in CakePHP? Function find() return results like this:

Array

( [0] => Array ( [Forum] => Array ( [id] => 1 [name] => Forum

            )

        [children] => Array
            (
                [0] => Array
                    (
                        [Forum] => Array
                            (
                                [id] => 3
                                [name] => Programowanie
                                [parent_id] => 1
                            )
                    )

                [1] => Array
                    (
                        [Thread] => Array
                            (
                                [id] => 11
                                [name] => Nowe forumowisko
                                [parent_id] => 1
                            )
                    )
            )
    )

[1] => Array
    (
        [Forum] => Array
            (
                [id] => 4
                [name] => Nauka
                [parent_id] => 0
            )

        [children] => Array
            (
            )
     )
)

How?

A: 

What are "children"? Seems like your tree is spawned across one-to-many relations

It is not necessary to use the Tree behavior to use this method - but all desired results must be possible to be found in a single query.

sibidiba
A: 
DSkinner