Dear all,
just want to ask anyone here can solve this problem?
I want to create a multilevel menu by generate with multilevel array. I just can't get perfect solution, it always got array_push error. My study the original idea come from http://www.weberdev.com/get_example-4830.html
But still cannot match my need.
This is My MySQL
[code]
-----------------------------------------
|id | parent_id| name | link |seq
|1 | 0 |dashboad |dashboard/|1
|2 | 0 |menu1 |menu1/ |2
|3 | 0 |menu2 |menu2/ |3
|4 | 0 |menu3 |menu3/ |4
|5 | 2 |add |add/ |1
|6 | 3 |add |add/ |1
|7 | 2 |edit |edit/ |2
|8 | 4 |add |add/ |1
------------------------------------------
[/code]
I want my array some thing like this
array('dashboard'=>array(
'id'=>'',
'name'=>'dashboard',
'title'=>'dashboard',
'permalink'=>base_url().'dashboard/',
'active'=>FALSE,
'child'=>NULL
),
'menu1'=>array(
'id'=>'',
'name'=>'menu1',
'title'=>'menu1',
'permalink'=>base_url().'menu1/',
'active'=>FALSE,
'child'=>array(
'add'=>array(
'id'=>'',
'name'=>'add',
'title'=>'add',
'permalink'=>base_url().'menu1/add',
'active'=>FALSE,
'child'=>NULL
),
'edit'=>array(
'id'=>'',
'name'=>'edit',
'title'=>'edit',
'permalink'=>base_url().'menu1/edit/',
'active'=>FALSE,
'child'=>NULL
)
),
),
...................[similar like above]
);
I only able to do until push_array, but it has warning Warning: array_push() [function.array-push]: First argument should be an array
I have this question had been discuss with a lot, but after I do some research most of the case are doing multilevel menu but in one level array. I want to achieve something multilevel array. Anyone can help?
The temporary array I am using static type.