Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
I am using the Megamenu on the Secondary Links menu. It returns the menu to me, but after the first set of links, the next root level parent item is nested inside of the first level of menu items in the preceeding UL.
Example:
Menu
Root Item 1
Root Item 2
--Child
--Child
--Child
------ Root Item 3
---Child
Etc etc. The 3rd Item should be outside of Item 2, not inside, as that is how my menu is structured.
Comment | File | Size | Author |
---|---|---|---|
#11 | theme.txt | 9.49 KB | thesuperav |
#7 | Screen-shot-2012-01-17-at-4.54.jpg | 108.48 KB | atodd |
#5 | mega_menu_fix.jpg | 39.87 KB | ClaudeS-1 |
Comments
Comment #1
chicagomom CreditAttribution: chicagomom commentedI am suddenly experiencing this as well, though with 6.x-2.0-beta2. I am using the primary menu, and until last week it was working like a charm. I think it may be a conflict with another module, though I'm not sure.
It looks like extra "ul"s (with no css classes) are being added so items get pushed down the structure.
It looks like the classless ul being added are being added where a closing /ul tag should occur to close out a portion of the structure. So maybe the forward slash is somehow being excluded?
Edited to add: Yes, all closing /ul tags are having the forward slash removed. Anyone have ideas?
Comment #2
Anonymous (not verified) CreditAttribution: Anonymous commentedThat's weird. I wonder what would cause that since we are building the lists using Drupal Core's theme item list.
Comment #3
chicagomom CreditAttribution: chicagomom commentedI'm not sure either. Only does this if menu items are more than 1 level deep. When I have a moment I'll see if I can trace when this is happening, to see if I can isolate the cause.
For now, I'm just doing a replace on all the classless uls and making them into close ul tags. It's a hack, but it works. So at the end of the html coding process for the menu, on line 132 of megamenu.utilities.inc I've added this:
$output = str_replace('<ul>','</ul>',$output);
Comment #4
ClaudeS-1 CreditAttribution: ClaudeS-1 commentedI'm getting the same problem (via Marinelli theme version 7.x-3.0-beta9 - referred here via an issue there: http://drupal.org/node/1052762). Apologies if the source codes are different versions and thus not applicable.
I'm getting very invalid HTML generated because some of my 2nd level menu items don't have children.
I thought I'd give detailed examples, in case it's different to what people are experiencing, or if it helps debug.
It works perfectly if the top menu item has (level 2) children which all have (level 3)children - in this case, the level 2 children are in bold, and at the top of a column, with each of their (level 3) children in un-bold below.
However, if my (level 2) children have no (level 3) children, they appear in bold in one column, with this markup:
Two errors here - firstly, the top div shouldn't have the class "mega four-col", as I want all 2nd level children to appear in one column.
And then, obviously, lots of ul items are being opened, never closed, with more ul items inserted.
This is what it should look like:
I'm going to try to see if I can understand the code that generates this, but if anyone who's more familiar with the Marinelli Code, or Drupal's inner workings, can help, that would be greatly appreciated.
Comment #5
ClaudeS-1 CreditAttribution: ClaudeS-1 commentedI've had a play with the mega_menu function that I found in Marinelli Theme. Presuming it's similar enough to the latest dev build of Megamenu to be of use to people.
I've fixed the function enough to work as I want it to:
- it returns valid HTML, with all LI and UL tags closed
- if 2nd level items ALL have 3rd level items, then it will output the relevant class for column width ("two-col" if there are two 2nd-level items), and give each 2nd-level item a separate column.
- if one or more 2nd level items DON'T have children, then all 2nd-level items will appear in ONE column (with "one-col" class). ALL of these 2nd-level items will have their own UL tag, and the LI will have class "menu-section-title".
- the result (for me, at least) is that 2nd level items are always bold, and 3rd level items are always non-bold.
I've attached images showing the 3 possible results, and my code is shown below (my bracketing convention is different to the original).
I don't know if this can be used to patch/fix the Mega Menu project's bug, as I don't use the original module, and don't know about Drupal patches/fixes. Just trying to help :)
Comment #6
jeramy CreditAttribution: jeramy commentedThank you, ClaudeS. This fix worked for me.
I am kind of surprised this hasn't been fixed in the Marinelli theme yet.
Using: Marinelli theme version 7.x-3.0-beta11
Comment #7
atodd CreditAttribution: atodd commentedClaudeS,
Thank you very much for this solution. Is there any way that you, or anyone else, could tell me which file to place this code in? Or do I need to create a new file? Any help would be greatly appreciated. The attached picture shows my current problem.
Using: Marinelli theme version 7.x-3.0-beta11
Comment #8
atodd CreditAttribution: atodd commentedCan anyone help me out here? I would like to know where to put the code that ClaudeS posted above. Does it need to be added to an existing file or do I need to create a new file? If it goes in an existing file, which one? Which lines do I replace if any? If anyone can help I would be greatly appreciative.
Using: Marinelli theme version 7.x-3.0-beta11
Comment #9
atodd CreditAttribution: atodd commentedOk so, for anyone who wants to know, I figured out where the code needs to go:
sites/all/themes/marinelli/theme/theme.inc
I replaced the code that is already there and my menu disappeared completely. So I changed the first line from "function subtheme_marinelli_mega_menu($variables)" to "function marinelli_mega_menu($variables)" and that made the menu show up again but the menu still was not showing up in multiple columns. So I am currently going through the code, line by line, to try to get it working. All of my second level items have at least two third level items so I don't know why it's not working.
If anyone has any insight on this please let me know. I would be greatly appreciative.
Using: Marinelli theme version 7.x-3.0-beta11
Comment #10
Anonymous (not verified) CreditAttribution: Anonymous commentedComment #11
thesuperav CreditAttribution: thesuperav commentedI'm also using Marinelli 7.x-3.0-beta11 and encountered the same error. I've patched my theme.inc (attached - rename to theme.inc) and it works fine for me. You could do a diff, but the changes start from line 168 to line 221.