[TYPO3-english] How can I give each menu item a different class? (optionSplit?)

Bernhard Kraft kraft at web-consulting.at
Wed Jan 2 10:42:38 CET 2013


Hello Jörg!

Am 30.12.2012 15:15, schrieb Jörg Klein:

> "Ralf-Rene Schröder" schrieb:
>> i always use something like this:
>>
>> NO.wrapItemAndSub = <li class="no menuid-{field:uid}
>> menupos-{register:count_MENUOBJ}">|</li>
>> NO.wrapItemAndSub.insertData = 1
>>
>> so i have classes witch are NOT to modify by editors
>
> that looks good. Currently I do know the value for the UIDs, but they might
> change in the future. With this implementation the class names would change
> as well; this would break the CSS styling.

Have an exact look at Ralf-Renes message again! He already gave you the 
answer: use {register:count_MENUOBJ}. Probably you overlooked the second 
line of his <li> tag. It wrapped because of the news/mail program. I 
guess it should look like:

> NO.wrapItemAndSub = <li class="no menuid-{field:uid} menupos-{register:count_MENUOBJ}">|</li>
> NO.wrapItemAndSub.insertData = 1

(Hopefully those lines dont wrap around).

The trick is not the "menuid-{field:uid}" but the 
"menupos-{register:count_menuOBJ}".

It will generate class names like "menupos-1", "menupos-2", "menupos-3", ...

I hope this is also fine for you instead of "one two three".

If this isn't what you need you have to specify your requirements more 
precise. Using options split it is possible to have something like 
"first middle last".


greetings,
Bernhard




More information about the TYPO3-english mailing list