[TYPO3-english] How to integrate a loop when building HMENU?

JoH asenau info at cybercraft.de
Wed Oct 27 11:35:10 CEST 2010


> As mentionned in my previous email, I prepared an picture and a part
> of html code to explain what I need to create for my website.
> 
> On the attached picture, you can see my menus in different situation.
> When the first page is displayed only the css layer menu are
> available/visible. 

OK - got it now :-)

So what you want to do is to attach an "expanded" branch of the menu to the ACTIVE part, while still keeping the already completely expanded CSS-layer menu. 

Although I don't think, it's a good idea to have double links in a menu - especially when it comes to screenreaders and the like - heres is a very simple approach using a second HMENU within the after property of the ACT state of the first level TMENU:

10 = HMENU
10 {
    1  = TMENU
    1 {
        expAll = 1
        wrap = <ul class="level1">|</ul>
        NO = 1
        NO {
            wrapItemAndSub = <li class="level1">|</li>
        }
        ACT < .NO
        ACT {
            ATagParams = class="active"
            after.cObject = HMENU
            after.cObject {
                special = directory
                special.value.field = uid
                1 = TMENU
                1 {
                    wrap = <ul class="level2_act">|</ul>
                    NO {
                        wrapItemAndSub = <li class="level2_act">|</li>
                    }
                }
                2 = TMENU
                2 {
                    wrap = <ul class="level3_act">|</ul>
                    NO {
                        wrapItemAndSub = <li class="level3_act">|</li>
                    }
                }
                3 = TMENU
                3 {
                    wrap = <ul class="level4_act">|</ul>
                    NO {
                        wrapItemAndSub = <li class="level4_act">|</li>
                    }
                }
            }
        }
    }
    2  = TMENU
    2 {
        expAll = 1
        wrap = <ul class="level2">|</ul>
        NO = 1
        NO {
            wrapItemAndSub = <li class="level2">|</li>
        }
        ACT < .NO
        ACT {
            ATagParams = class="active"
        }
    }
    3 < .2 
    3 {
        wrap = <ul class="level3">|</ul>
        NO.wrapItemAndSub = <li class="level3">|</li>
        ACT.wrapItemAndSub = <li class="level3">|</li>
    }
    4 < .2 
    4 {
        wrap = <ul class="level4">|</ul>
        NO.wrapItemAndSub = <li class="level4">|</li>
        ACT.wrapItemAndSub = <li class="level4">|</li>
    }
}

HTH

Joey

-- 
Wenn man keine Ahnung hat: Einfach mal Fresse halten!
(If you have no clues: simply shut your gob sometimes!)
Dieter Nuhr, German comedian
Xing: http://contact.cybercraft.de
Twitter: http://twitter.com/bunnyfield
TYPO3 cookbook (2nd edition): http://www.typo3experts.com


More information about the TYPO3-english mailing list