Reputation: 6070
I am Trying to Implement the Dynamic Menus
i Have two Tables in my Database
pbs_forms
includes Form Path Form Path link etc
Second Table Name is pbs_formsingroups
it shows that form belongs to which group
Here is how right now i am getting data in my view
$GetForms=$this->CommonModel->get_by_join($columns,$PTable,$joins,$where);
foreach($GetForms as $key => $row){
list($NavBar, $MainMenu, $SubMenu) = explode("/", $row['FormPath']);
$arrayLeftMenuList = array();
$arrayLeftMenuList[$key]['NavBarMenuLink'] = $NavBar;
$arrayLeftMenuList[$key]['LeftMainMenu'] = $MainMenu;
$arrayLeftMenuList[$key]['LeftSubMenu'] = $SubMenu;
$arrayLeftMenuList[$key]['FormCIPath'] = $row['FormCIPath'];
$arrayLeftMenuList[$key]['MainMenu_OrderNo'] = $row['Order_MainMenu_No'];
$arrayLeftMenuList[$key]['SubMenu_OrderNo'] = $row['Order_SubMenu_No'];
$arrayLeftMenuList[$key]['HaveSubMenus'] = $row['SubMenu'];
}
Data is Coming from the Database Fine..
Now When i Try This in Code:
foreach($arrayLeftMenuList as $key => $value){
echo $arrayLeftMenuList[$key]['LeftSubMenu'];
}
In Result I only Get
Users
Instead I should Be Getting Both Search Prize Bond
and Users
?
Can Anyone Understand the Problem i have Stated above and Show me a solution that how to solve this issue?
Upvotes: 0
Views: 1089
Reputation: 6070
My Mistake, Got The Solution, This was a Plain Mistake that i could not find before.
I changed
$arrayLeftMenuList = array();
to
$arrayLeftMenuList[$key] = array();
and now its working Great. :)
Upvotes: 1