I'm trying to simplify my menu, that i will pass into my view, the problem is menu and submenu is not active. This is my controller:
parent::__construct();
$this->menu = array(
'menu' => 'definition',
'submenu' => 'workplace'
);
And i have this in my controller method:
$data = array(
$this->menu, // menu is right here
'list_workplace_type' => get_wp_type()->result_array()
);
var_dump($data);die;
$this->load->view('wp', $data);
And the result is like below:
array (size=2)
0 =>
array (size=2)
'menu' => 'definition'
'submenu' => 'workplace'
'list_workplace_type' =>
array (size=2)
0 =>
array (size=1)
'szWorkplaceTypeName' => 'Kantor Pusat'
1 =>
array (size=1)
'szWorkplaceTypeName' => 'Kantor Cabang'
What I expected is more like this:
array (size=2)
'menu' => 'definition'
'submenu' => 'workplace'
'list_workplace_type' =>
array (size=2)
0 =>
array (size=1)
'workplaceTypeName' => 'Kantor Pusat'
1 =>
array (size=1)
'workplaceTypeName' => 'Kantor Cabang'
I used array_push() but still doesn't work properly.