Hi all,
I have a class for my site menu. it works ok in that I can declare a new menu, call my 'get menu' function and it outputs on screen.
I've just introduced a 2nd level to my menu so as i'm looping through my menu items, i declare a new sub-menu and call the function. I know there are items in the database but nothing is coming back. Any help would be appreciated.
That works fine. Now, when I add the following in, nothing comes back for my sub menu:
I have a class for my site menu. it works ok in that I can declare a new menu, call my 'get menu' function and it outputs on screen.
I've just introduced a 2nd level to my menu so as i'm looping through my menu items, i declare a new sub-menu and call the function. I know there are items in the database but nothing is coming back. Any help would be appreciated.
PHP:
<ul class="menu"><?php
$menuLinks=array();
$myMenu=new menu();
$menuLinks=$myMenu->get_menu(1,0);
foreach($menuLinks as $i => $value) {
echo "<li><a href='".$menuLinks[$i]->get_url()."'>".$menuLinks[$i]->get_name()."</a></li>";
}
?></ul>
That works fine. Now, when I add the following in, nothing comes back for my sub menu:
PHP:
<ul class="menu"><?php
$menuLinks=array();
$myMenu=new menu();
$menuLinks=$myMenu->get_menu(1,0);
foreach($menuLinks as $i => $value) {
echo "<li><a href='".$menuLinks[$i]->get_url()."'>".$menuLinks[$i]->get_name()."</a></li>";
$sublinks=array();
$mySubMenu=new menu();
$sublinks=$mySubMenu->get_menu(1,$menuLinks[$i]->get_id());
foreach($sublinks as $y => $value) {
echo "<li><a href='".$sublinks[$y]->get_url()."'>".$sublinks[$y]->get_name()."</a></li>";
}
}
?></ul>