Menu with 2 colors: Last menuitem depends on the menuitem before

Submitting your vote...
Not rated yet. Be the first who rates this item!
Click the rating bar to rate this item.

The problem: We have created a menu with optionSplit, for the last menuitem you have 2 css classes.

How we can see easily at the following picture the last menueitem depends on the item before, it does need a dark or a light background.

With optionSplit its quite simple to change the 2 colors. But how you know if the last item needs a light or dark background?

 

Have a look at following typoscript snippet:

 

temp.mymenu=HMENU
temp.mymenu.1=TMENU
temp.mymenu.1.NO {
  # optionSplit for the first menuitem and the following, one dark one light
  allWrap = | |*| |||||*|
  allWrap.override.cObject=COA
  allWrap.override.cObject{
    # the override of the allWrap property is executed if the actual menuitem (register:count_HMENU_MENUOBJ) is the last(register:count_menuItems)
    if.value.data=register:count_menuItems
    if.equals.data=register:count_HMENU_MENUOBJ
    10=TEXT
    10{
       # sets the light class for a odd count of the menuitems
      value=|
      if.isFalse.prioriCalc=1
      if.isFalse.cObject=TEXT
      if.isFalse.cObject.insertData=1
      if.isFalse.cObject.value={register:count_HMENU_MENUOBJ}%2
    }
    20<.10
    # Negate the whole thing and set the dark class in this case
     
    20.if.negate=1
    20.value=|
  }
}

 

More information:

tsref stdWrap (override,prioriCalc)

tsref optionSplit

tsref if

2 menues: divide pages in even and odd

Forum thread that leadet to this solution (german)


Top 10 Updates

Using lightbox without extension geändert am  13-Jun-2008 14:20:51
Custom field for GMENU alt text geändert am  13-Jun-2008 13:58:07
Extending typoscript properties with stdWrap geändert am  13-Jun-2008 13:54:32
Create menus using data from other tables than "pages" V2  geändert am  24-Mar-2008 13:02:09
Login geändert am  17-Mar-2008 12:47:52
Forum geändert am  17-Mar-2008 10:07:47
Who is Typo3wizard.com geändert am  26-Dec-2007 16:07:32
Menu as un-nested lists (iphone navigation) geändert am  29-Oct-2007 15:05:53
IF Conditions with AND and OR operators geändert am  16-Oct-2007 19:16:04
UserFunc to fix problems with HMENU type "special=updated"  geändert am  16-Oct-2007 18:58:40
Deutsch
Search: