Skip to end of metadata
Go to start of metadata

I have the following code

{menu}
 {menuicon:user1}My
 {compound-menuitem:userspace|icon=user1_earth|caption=Personal Space|checkexists=true}
 {compound-menuitem:home|space=My|icon=presentation|caption=Personal Dashboard}

How can I add a class to "My"? When I try using a

or something of the sort it doesn't work. The menu breaks and My doesn't appear any longer. When I use compound-menuitem I can't say that I don't want the link to actually go anywhere. Is this even the correct format (a title, for the drop down menu, that doesn't go anywhere) ? It works..

  • No labels

6 Comments

  1. Unknown User (dmatsum)

    Haven't tried it within a menu, but you might be able to use the span or div macros from the Content Formatting Plugin to apply the class.

    1. Unknown User (rn)

      Both either don't work or break my menu. (I know i havent applied a class, the elements wont even show up...)

      Examples:

      1.
      {menu}
       {menuicon:user1}{span}My{span}
       {compound-menuitem:userspace|icon=user1_earth|caption=Personal Space|checkexists=true}
      2.
      {menu}
       {menuicon:user1}{div}My{div}
       {compound-menuitem:userspace|icon=user1_earth|caption=Personal Space|checkexists=true}
      3.
      {menu}
       {span}{menuicon:user1}My{span}
       {compound-menuitem:userspace|icon=user1_earth|caption=Personal Space|checkexists=true}
      4.
      {menu}
       {div}{menuicon:user1}My{div}
       {compound-menuitem:userspace|icon=user1_earth|caption=Personal Space|checkexists=true}
      
      1. Unknown User (dmatsum)

        I'm surprised I would assume it would have inserted either way. It might have broken everything in doing so, but that is a different issue. Might be worth looking at the generated HTML to see how it is structured.

  2. Unknown User (jlowry)

    You can use

    {span:class=myclass}my{span}
    

    if you define the class in the custom CSS it will be applied.
    eg:

    .myclass {
      font-size: x-large;
      color: red;
    }
    
    1. Unknown User (rn)

      Thanks James but that isn't the problem. The problem is when I add the span it ruins the menu. Maybe you could paste my code into a layout and then see what I mean.

  3. Unknown User (gfraser)

    Don't use a span - there's a subclass parameter on the menu, su-menu and sub-submenu macros IIRC for adding a class to the sub menu. Also, there's a class param which adds a class to the item itself.