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

Philipp Gampe philipp.gampe at typo3.org
Sun Dec 30 20:04:06 CET 2012


Hi Jörg Klein,

Jörg Klein wrote:

> Yes; what I want to find is a way, where
> a) my editors cannot manipulate these class names themselves and where
> b) TYPO3 adds the right class names automatically (also after pages have
> been moved around.

Then you should use this:

In PageTS config, add

TCEFORM.pages.layout {
	addItems {
		4 = xxxx:xx
		5 = xx:xxxx
	}
	altLabels {
		0 = Flash+XXXXXXX
		1 = Flash+XXXX:XX
		2 = Flash+XX:XXXX
		3 = XXXXXXX
		4 = XXXX:XX
		5 = XX:XXXX
	}
}

You can also add a path to a language file if you need translations instead 
of static texts.

This adds you values to the layout field (note that the first layout field 
in the first tab is called header_layout, not layout).

Then you can use a case construct to set the CSS classes.


NO.stdWrap2.cObject = CASE {
	default = <div class="menu-item css-default">|</div>
	key = layout
	1 = <div class="menu-item css-1">|</div>
	2 = <div class="menu-item css-2">|</div>
	etc
}

That way you can define your values, save them in the page properties, but 
make then unchangeable by editors.

Best regards
-- 
Philipp Gampe – PGP-Key 0AD96065 – TYPO3 UG Bonn/Köln
Documentation – linkvalidator
TYPO3 .... inspiring people to share!



More information about the TYPO3-english mailing list