0

I have a Drupal 6.26 site with a custom menu like so:

-Category 1
--Page 
--Page
-Category 2
--Page
--Page
...

All Category pages are genrated by a view (e.g. sitename.com/intranet/category)

All pages that are children of each category are nodes.

My primary problem is, when a category page is selected, the menu it's associated with doesn't expand. The site owner doesn't want the menus expanded by default.

A secondary problem is the menu won't expand when one of the child pages is selected unless it has the path /intranet/category/*, which is not always desired.

Hopefully a bit of code can solve this issue.

1 Answer 1

0

Five lines of code placed in a views template file solved the issue:

 <?php
    $path = drupal_get_path_alias(check_plain($_GET['q']));
    $menu_item = menu_get_item($path);
    $menu_item['href'] = $path;
    if($path && $menu_item) {
      menu_set_item(NULL, $menu_item);
    }
  ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.