Hi All,
I'm really stuck with this one - although it's probably the world's most obvious answer!
I'm updating someone else's code and have the below function - it's used to display menu items from a CMS. It works fine in PHP 5.2, but in 5.1 only shows the first top level nav item, and the first second level item.
It's because it is going down through the recursive functions, but is not starting where it left off after a recursion (if you see what I mean!)PHP Code:function sortMenu(&$menus, $parent) {
foreach ($menus as $menu) {
if ($menu['parent'] == $parent) {
$sortedMenu[$menu['id']] = $menu;
if ($temp = sortMenu($menus, $menu['id'])) {
$sortedMenu[$menu['id']]['child'] = $temp;
}
}
}
}
Any ideas what I'm doing wrong?
Cheers,
Kev







Bookmarks