I have an odd request!

I split my site into sections using menus rather tha taxonomy module. Each section had a menu. I displayed each menu block according to the path - which is set by path_auto. ie. when someone is in the /support section a support menu shows. Each block Each block had a heading and a ul list for the nav.

However breadcrumbs don't work properly with this arrangement as they don't show the menu name in the trail.

And I want to instead put everything in one big menu, lets call it 'nav'.

My problem is that across the top of the page I have my main section links. And I really don't want to repeat them in the block nav.

With CSS I could achieve this by doing something like this:

<style>
.content ul.menu li.leaf, .content ul.menu li.lcollapsed { display: none; }
</style>

But I also don't want them to display with the stylesheet turned off.

Problem 1.

I'd like it to look like it did as I had origionally with the section your in as a clickable h2. So I figure there must be away to use some regular expression trickery to strip the outer ul tags, bin the li.leaf and the li.collapsed at the top level of the nav. And transform the li.expanded to a h2.

<div class="content">
<ul class="menu">
<li class="expanded"><a href="#" title="" class="active">link</a>
<ul class="menu">
<li class="leaf"><a href="#" title="">link</a></li>
<li class="leaf"><a href="#" title="">link</a></li>
</ul>
</li>
<li class="collapsed"><a href="#" title="">link</a></li>
<li class="collapsed"><a href="#" title="">link</a></li>
</ul>
</div>

Problem 2.

Is how do I theme individual menus? I couldn't find a themeable menu section in the menu module. I figure if i could theme it in my template I could use a switch depending on the block.

I know it's alot of work for not alot, but I think this would be a really good exercise, in theming and regular expressions.

Comments

StenBH’s picture

I'm not a guru, but to get things started I would point in two directions that I tried out in trying to accomplish something similar.
The first was to use phptemplate. You then have to indicate that which standard function you whish to replace. Menu links are generated by (or rather "through") theme_menu_item_link and the tree by theme_menu_tree.
This has to be pointed out in the template.php file and handled by menu_item_link.tpl.php and menu_tree.tpl.php respectively. There is a good article here on drupal.org about how to use template.php, read it!
As an alternative, and maybe that is needed if you are doing advanced stuff, you need to write a new module. Start with the nice_menus module and do the changes you need! If it is usefull you should publish it here!
I hope that gives you some help to get started!
Sten