By Gham on
Hi
I'm trying to find a way to add a separator or delimiter between the main menu items in D7.
Has anyone managed to achieve this ?
Appreciate any replies.
G.
Hi
I'm trying to find a way to add a separator or delimiter between the main menu items in D7.
Has anyone managed to achieve this ?
Appreciate any replies.
G.
Comments
To my knowledge, the struggle
To my knowledge, the struggle is still going on.
Struggle is over.
I took this person's D6 code: http://browse-tutorials.com/snippet/menu-delimiters-drupal
and ported it to D7.
defined error
For those getting a 'Notice: Undefined index' message when using this piece of code try using
in the if statement so that it looks like
Otherwise great piece of code for those wanting to use delimiters that can't be accomplished with CSS.
......................................................................................................
Marton Bodonyi
http://www.codesidekick.com
.........................................................
Still getting that error...
It seems like this code should fix the undefined id problem but doesn't. What's stranger is that the variable is defined and I can theme all my menus correctly, but the error still persists. Any ideas?
A temporary fix that doesn't get to the bottom of the problem:
Replace this line:
with this:
Very strange, since even with this code the menu ul's still get their ids.
This code ignores all other menus
It seems like the first if statement in your code checks for the correct menu and applies the correct delimiter, but ignores all other menus.
I've modified your code to the following:
The rest of the code is moved to outside of the if statement.
However, with this code I am still getting the error:
$links['attributes']['id'] is defined so I'm not sure what the problem is. All my menus are output correctly. Any help would be appreciated.
or you could use css
you could target the menu items and add a right border, then target the last item to remove the border.
yep
missWilder++ This was the easiest thing to do.
I totally agree although I'm
I totally agree although I'm having issues since Drupal doesn't output class="last" on the last item. So did you just use a theme hook to change the output?
Hi, this is kind of an old
Hi, this is kind of an old thread now, but I thought this might help someone. Here's an easy way to add a delimiter to main menu items using theme_menu_link()
This will add a span-wrapped delimiter to each menu item except the last one. It works well for me, hopefully it helps you too.
how can i add this only to my
how can i combine this code with a seperator only for the secondary menu??
This works for me without an error!
It works!
Thank you so much for this code snippet!! Been at it for hours...
The code added delimiter into my Management-menu.
Hi,
i want to add delimiter image in my Main-menu but when i added the code into my template.php its added delimiter into my Management-menu.
zakir.gori
Use Menu attributes module
I think there is no need any coding etc. My suggestion:
Use Menu attributes module and give special ID or classes to your menu items. Then you can do anything with CSS.
Example:
I used it in my main menu to make list items have different background images:
http://www.mediasaur.com/en
Mediasaur | http://www.mediasaur.com/en | http://twitter.com/mediasaur
Before asking for help, please read this http://slash7.com/2006/12/22/vampires/ and don't be a "Help Vampire". :)
not work on me
i've tried this http://drupal.org/node/1214026#comment-5700174, and target my custom menu
if ($attributes['id'] == 'menu-menu-tab') {
but no result (|) shows.
www.dhafy.com