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

Jörg Klein joerg at klein-family.com
Sun Dec 30 15:10:31 CET 2012


Hi Jost and Philipp,

thanks for your answers!

"Philipp Gampe" schrieb:
>> you could use a field from the page record of the menu entry. For
>> example, the following TS sets the subtitle of a page as class:

I see. Good idea.

However, that means that the editors have to add this class to the according 
pages by hand - and I fear that is not optimal: When pages are moved they 
might end up with wrong classes at wrong places. That would give editors the 
possibility to mess up the menu (even without any bad intention).

> Be aware that you allow your editors to create XSS attacks this way. They
> could enter any HTML code in between.

Thank you for the hint. I think I should check my TypoScript setup for such 
cases now.....

> If you can somehow limit the number of classes, then you could use a field
> with fixed values (which you can set via PageTS).
> You could also use the uid or pid of the page as unique class.

If I remember correctly class names are not allowed to start with a number; 
I would then have to create something like
class="no menuid-{field:uid}".

> If you really need an individual class, then you should use multiple wraps
> und put the data part into an own wrap where you can use htmlspecialchars.

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.

Cheers!

Jörg 




More information about the TYPO3-english mailing list