Hi everyone,
I have the latest version of CMSMS installed and am trying to adapt the menu manager to work with a design that has a requirement for each top level link to have its own class. I adjusted the template to only use the li tag and none of the the other associated class. I also found a cycle values tag which kind of worked but instead of listing them in the exact order it did the first two classes followed by a random 2 others and so on. This made me think that maybe the cycle values is meant for only 2 items.
Does anyone know a way to assign specific classes to the top level of a drop down menu. I have been searching the forums for a couple hours now and I appreciate any help.
Thanks,
Chris
Menu Manager top level individual classes
-
- Forum Members
- Posts: 47
- Joined: Thu Nov 09, 2006 7:33 pm
Re: Menu Manager top level individual classes
I had a similar thing. My solution, though not nice, does work.
But I had 4 groups and no more, so I could hardcode it a bit.
Make multiple menu template and give each toplevel it's own class.
(dirty code but I think you understand)
{menu template=a start_element=1}
{menu template=b start_element=2}
{menu template=c start_element=3}
{menu template=d start_element=4}
Downside is you need to make multiple templates
With layouts attached to menu groups:
Split you pages in groups. Each group will represent a menu(group)
Now code it "read" to friendly position of a particulair page.
So page 2.1 will have a parent "2"
With this number, when assigned, you put it in the template and then call it with css.
Some code to illustrate:
in a page/template:
{assign var='styleposition' value=$friendly_position|truncate:1:''}
So the styleposition is: {$styleposition}
(on page 2.3.x whatever the output wil be "2")
so a code like
Can now be used with the {$styleposition} :
It might not be exactly what you wany/need, but it might give you a starting point
*) disclaimer: I'm not a programmer, there are most likely better ways?
But I had 4 groups and no more, so I could hardcode it a bit.
Make multiple menu template and give each toplevel it's own class.
(dirty code but I think you understand)
{menu template=a start_element=1}
{menu template=b start_element=2}
{menu template=c start_element=3}
{menu template=d start_element=4}
Downside is you need to make multiple templates
With layouts attached to menu groups:
Split you pages in groups. Each group will represent a menu(group)
Now code it "read" to friendly position of a particulair page.
So page 2.1 will have a parent "2"
With this number, when assigned, you put it in the template and then call it with css.
Some code to illustrate:
in a page/template:
{assign var='styleposition' value=$friendly_position|truncate:1:''}
So the styleposition is: {$styleposition}
(on page 2.3.x whatever the output wil be "2")
so a code like
Can now be used with the {$styleposition} :
It might not be exactly what you wany/need, but it might give you a starting point
*) disclaimer: I'm not a programmer, there are most likely better ways?
Last edited by jack4ya on Fri Oct 30, 2009 9:37 pm, edited 1 time in total.
Re: Menu Manager top level individual classes
Ajust menu template according your needs:
Code: Select all
class="menu_class_{$node->hierarchy|truncate:1:""}"
Re: Menu Manager top level individual classes
See! It can be quicker and (c)leaner! 
At least i was on course with the last bit.
Valuable lesson today for me.

At least i was on course with the last bit.

Valuable lesson today for me.
-
- Support Guru
- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
Re: Menu Manager top level individual classes
Code: Select all
class="menu_depth_{$node->depth}"
want each node to have it's own class:
Code: Select all
class="menu_{$node->alias}"
Code: Select all
{if $node->depth == 1}class="menu_{$node->alias}" {/if}
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
-
- Forum Members
- Posts: 47
- Joined: Thu Nov 09, 2006 7:33 pm
Re: Menu Manager top level individual classes
Thank you very much for the help this solved the problem.