Welcome Guest, Not a member yet? Register   Sign In
Creating dynamic dropdown menu system
#3

[eluser]Pegasus275[/eluser]
let's assume that you have

id int
mnu_id id of parent menu
menu_name
url menu_url
etc...

you need to create function. the recursive function

for example

function my_menu($root_id)//0 for rootSmile
{
$menus = $this->db->query("select * from my_menu where mnu_id=$root_id");
if($menus->num_rows() > 0){
foreach($menus->result() as $menu){
$data['menu_id_'.$root_id] = array($menu->id,$menu->name,$menu->url,$menu->etc);
$data['menu_id_'.$root_id.'_child'] = my_menu($menu->id);
}
}
return $data;
}

You will get array of menu items you defined, note: this is just exampleSmile


Messages In This Thread
Creating dynamic dropdown menu system - by El Forum - 02-05-2011, 08:12 PM
Creating dynamic dropdown menu system - by El Forum - 02-05-2011, 11:08 PM
Creating dynamic dropdown menu system - by El Forum - 02-07-2011, 03:20 AM



Theme © iAndrew 2016 - Forum software by © MyBB