By dedreign on
I couldn't find this anywhere and this is a total hack, but I only wanted my sub-menus clickable. Seems like something a lot of folks would want.
I updated nice_menus.module to unlink any parent menu item. I wrote a function that just replaces "href" with a random string and then added cursor:pointer to the CSS of that class so it looks right when you hover. If there is a better way I'd love to hear it.
if ($children) {
$output .= '<li id="menu-'. $mlid .'" class="'. $parent_class . $path_class .'">'. unlinkMe(theme('menu_item_link', $menu_item['link']));
$output .= '<ul>';
$output .= $children;
$output .= "</ul>\n";
} else {
$output .= '<li id="menu-'. $mlid .'" class="'. $parent_class . $path_class .'">'. theme('menu_item_link', $menu_item['link']);
}
$output .= "</li>\n";
}
else {
$output .= '<li id="menu-'. $mlid .'" class="'. $path_class .'">'. theme('menu_item_link', $menu_item['link']) .'</li>'."\n";
}
}
}
return $output;
}
function unlinkMe($str){
$str = str_replace("href", "black", $str);
return $str;
}
Comments
Maybe better simple remove <a> tag?
function unlinkMe($str){
$str = preg_replace("/(.*?)<\/a>/si", "\$2", $str);
return $str;
}
Of Course!
But that would mean writing a regular expression :). They frustrate me. I will use your code you don't mind. Thanks.
Howto
Please could you explain where to put and how to use it for someone quite new to drupal ?
I copied it into nice_menus.module but nothing happened. I have no futher idea so please explain a little more detailed.
Many thanks.
Dagido.