the problem is I am stuck with displaying the data in a table. In the file attached you can see what I am trying to achieve...
I would like to display the binary tree in a table. After lot of pain I managed to figure out how to deal with colspans.. but I don't know how to populate it correctly...The problem is with empty peers...
I would like to have a node's method: $tree->nodes->to_table_array(4); Where the parameter is $depth -> how deep it should go
So I should get something like:
$arr = array(
---=>array(4,null, null, 5),
---=>array(6, null, null, null, null, null, 7, 8)
The key of the array is the table row or depth of the tree... each then, has an array of ids or null if there is no child there
I can set a desired depth (up to 10) and the array must populate for each "layer"/"row" even if it has only nulls!
I will nee also test case (with a table like in the attached file) and instead of icons there should be node ids or &nbsp; for empty cell