[TYPO3] TypoScript menu config

Christopher Torgalson bedlamhotel at gmail.com
Mon Nov 5 21:07:33 CET 2007


Hi,

On Nov 5, 2007 9:03 PM, Lamb, Brian <blamb at jcvi.org> wrote:
> Hello all,
>
>
>
> I currently have the following TypoScript to generate a menu on my site:
>
>
>
> # Top menu
>
> top.menu_1 = HMENU
>
> top.menu_1.special = list
>
> top.menu_1.special.value = 4, 5, 6, 123, 7, 8, 9, 10
>
>
>
> # First level menu-object, textual
>
> top.menu_1.1 = TMENU
>
> top.menu_1.1 {
>
>   # Normal state properties
>
>   NO.allWrap = <li> | </li>
>
>   NO.stdWrap.htmlSpecialChars = 1
>
>
>
>   # Enable active state and set properties:
>
>   ACT = 1
>
>   ACT.stdWrap.htmlSpecialChars = 1
>
>   ACT.allWrap = <li class="active"> | </li>
>
> }
>
>
>
> # Side menu
>
> side.menu_1 = HMENU
>
> side.menu_1.entryLevel = 1
>
>
>
> # First level menu-object, textual
>
> side.menu_1.1 = TMENU
>
> side.menu_1.1 {
>
>   tt_content.stdWrap.dataWrap >
>
>
>
>   # Normal state properties
>
>   NO.subst_elementUid = 1
>
>   NO.allWrap = <li> | </li>
>
>   NO.ATagTitle =
>
>
>
>   # Enable active state and set properties:
>
>   ACT = 1
>
>   ACT.stdWrap.htmlSpecialChars = 1
>
>   ACT.allWrap = <li class="side_active"> | </li>
>
> }
>
>
>
> # Second level menu-object, textual
>
> side.menu_1.2 = TMENU
>
> side.menu_1.2 {
>
>   tt_content.stdWrap.dataWrap >
>
>
>
>   # Normal state properties
>
>   NO.subst_elementUid = 1
>
>   NO.allWrap = <li class="subA">|</li>
>
>   NO.ATagTitle =
>
>
>
>   # Enable active state and set properties:
>
>   ACT = 1
>
>   ACT.stdWrap.htmlSpecialChars = 1
>
>   ACT.allWrap = <li class="side_active subA"> | </li>
>
> }
>
>
>
> The problem is the active class I'm assigning colors the background of
> the link. But when the menu item is on level 2, both the level 2 link
> and its parent get colored. How can I set it so that only the active
> class is applied to the current page and not its parents?


Change every occurrence of 'ACT' to 'CUR'.

Incidentally, with the TS you've used, if any of your menus have
multiple levels, your HTML will be invalid. Changing the various
instances of 'allWrap' to 'wrapItemAndSub' will fix that problem.


-- 
Christopher Torgalson
http://www.typo3apprentice.com/


More information about the TYPO3-english mailing list