2010-02-18, 12:44:19
(This post was last modified: 2010-02-18, 12:44:53 by pagesbytom.)
Hi,
I am trying to create a sub-navigation menu on my website which displays all the sub pages for the current page.
I am using the multi-level navigation plugin as a base for this plugin but have come across a slight problem.
The following code will correctly ouput all of the child pages for the selected parent page, however when i select one of these child pages I am struggling to get the menu to stay visible.
I am assuming it's something to do with the $menu variable not containing anything when a child page has been selected?
Any ideas how i can get this to output the sub menu when a child page has been selected also?
Thanks very much.
I am trying to create a sub-navigation menu on my website which displays all the sub pages for the current page.
I am using the multi-level navigation plugin as a base for this plugin but have come across a slight problem.
The following code will correctly ouput all of the child pages for the selected parent page, however when i select one of these child pages I am struggling to get the menu to stay visible.
I am assuming it's something to do with the $menu variable not containing anything when a child page has been selected?
Code:
$menu = $data->xpath('//*[menuStatus=""][parent="'.$a.'"]');
usort($menu,"menu_sorting");
if (count($menu) > 0) {
echo "<ul class='submenu'>\n";
foreach ($menu as $link) {
echo '<li'.("$link->slug"==$a?' class="active"':'').'><a href="'.$link->url.'">'.($link->menu!=""?$link->menu:$link->title).'</a></li>';
}
echo "</ul>";
}
Any ideas how i can get this to output the sub menu when a child page has been selected also?
Thanks very much.