Community & Support

Suckerfish - Printing Primary Links as a tree, and assigning an id to the list

Hi all,

I've done my best to find a solution to this combined problem, and have managed to get an answer to each part, but not the combination.

I am looking to add a (Son of) Suckerfish menu for the primary links of my theme. I have found code to add an id to the <ul> tag, and code which will allow me to print the tree of menu items, but not one that combines them both.

With the tree option I get the menus working with an id on the <div>, but the whole div disappears in IE7, so I thought trying the id on the <ul> would solve this as it works on mockups I've done where I put the menu tree in by hand.

Your help is greatly appreciated.

Jerome

Comments

As of D6, you'll likely need

As of D6, you'll likely need to duplicate a copy of menu_tree() and its children. An issue has been opened (#387930: Make menu_tree() more theme-friendly)

<?php
function _my_menu_tree($menu_name = 'navigation') {
...
 
$menu_output[$menu_name] = _my_menu_tree_output($tree);
...
}

function
_my_menu_tree_output($tree) {
...
 
$link = _my_top_menu_item_link($data['link']);  // theme for 1st level menu
...
 
$output .=  theme('menu_item', ..., _my_submenu_tree_output($data['below']), ...);
...
}

function
_my_submenu_tree_output($tree) {
...
 
$link = _my_sub_menu_item_link($data['link']);  // theme for sublevel menu
...
 
$output .=  theme('menu_item', ..., _my_submenu_tree_output($data['below']), ...);
...
}
?>

Superfish

BTW, you might want to check out Superfish

My preference is to use CSS

My preference is to use CSS rather than Javascript, not that it makes a big difference now I guess, but should be more accessible.

Superfish is suckerfish in

Superfish is suckerfish in jQuery.
CSS menu is the primary mechanism it uses. Javascript adds additional features. It works with/without JS enabled.