[eluser]Unknown[/eluser]
Hi Guys,
I'm relatively new to codeiniter and I was wondering whether anyone could help me with this problem I have.
I am creating an web application which allows users to add unlimited roles which all have a parent child relationship and can be as many level deep as they require.
I have created a recursive function which creates an array of the parent child relationships for all the roles but I need to figure and what is best practice in codeigniter for passing this array to a view and displaying it correctly.
Here is an example of the array I am left with once I have passed data from the database to a helper to create a 'role tree'....
Code:
[role_tree] => Array
(
[0] => Array
(
[role_id] => 1
[role_name] => tester
[children] => Array
(
[0] => Array
(
[role_id] => 4
[role_name] => test 2
)
[1] => Array
(
[role_id] => 6
[role_name] => uyuiy
)
[2] => Array
(
[role_id] => 7
[role_name] => uyuiy
[children] => Array
(
[0] => Array
(
[role_id] => 10
[role_name] => bamm
[children] => Array
(
[0] => Array
(
[role_id] => 11
[role_name] => testing tree
)
)
)
)
)
[3] => Array
(
[role_id] => 8
[role_name] => uyuiy
)
[4] => Array
(
[role_id] => 9
[role_name] => test new
)
)
)
[1] => Array
(
[role_id] => 5
[role_name] => test 3
)
)
)
What I want to do is create a view with each child indented from its parent in some kind of list format but I am not sure how to go about this now I have this array.
Thanks for looking.