Thursday, 15 March 2012

cakephp get tree into an array -



cakephp get tree into an array -

i have table nodes acts tree. have tree structure:

null null -child --childofchild --childofchild -child null

etc...

i want array construction this:

array( 0 => array( id => ''), 1 => array( id => '', array( 0 => array( id => '', 0 => array( id => '', ) 1 => array ( id =>''), 1 => array(id => '') 2 => array ( id => '')

i have missed closing brackets, thought array including array every node within array of parent. arrays contain node's id. tried find('threaded) can't want. ideas??

this you'r looking for:

$categories = $this->category->find('threaded', array( 'fields' => array('id', 'parent_id', 'name'), 'order' => array('lft asc') // or array('id asc') ));

arrays cakephp tree

No comments:

Post a Comment