开发者

Typoscript navigation setup

I am new to typo3 and I have to setup a navig开发者_如何学JAVAation. I have already done the tutorials found at Timerate and I have built the demo navigation (week 2 in the tutorial).

Now I have to setup a navigation that must look like :

Link 1 | Link 2 | Link 3 | Link 4

the back en structure is the following :

Link 1
Link 2
Link 3 (shortcut to sub link 1)
    Sublink 1
    Sublink 2
Link 4

The whole menu is working fine when I am in section designated by link 1, link 2 and link 4 but there is nothing showing when I click on link 3.

The Sublinks are to be shown in a secondary navigation

Here is the typoscript that I have on my root ts template (I'm using TemplaVoila) :

lib.field_topmenu = HMENU
lib.field_topmenu {
    special = directory
    special.value = {$idMain}
    entryLevel = 2
    1 = TMENU
    1.NO = 1
    1.wrap = <div id="menu"><ul> | </ul></div>
    1.NO.wrapItemAndSub = <li>|</li>
    1.ACT < .1.NO
    1.ACT.ATagParams = class='active'
    2 < .1
}

What would be the best way to achieve this?


glad you're on board of TYPO3.

As far as I can remember, there's no effect on the entry level of a special = directory.

That's a working solution:

lib.field_topmenu = HMENU
lib.field_topmenu {
    special = directory
    special.value = 1
    1 = TMENU
    1.NO = 1
    1.wrap = <ul> | </ul>
    1.NO.wrapItemAndSub = <li>|</li>
    1.ACT < .NO
    1.ACT.ATagParams = class='active'
    2 < .1
}

You should remove the id=menu as it will be repeated the levels downwards, therefore invalidating your HTML

Here's a solution we usually use, it also uses subtitles etc. and adds special classes to the first and last elements of your navigation list:

lib.navi.one = HMENU
lib.navi.one {
    1 = TMENU
    1 {

        noBlur = 1
        wrap = <ul>|</ul>
        NO = 1
        NO {
            wrapItemAndSub = <li class="first">|</li> |*| <li>|</li> |*| <li class="last">|</li>
            altText = subtitle // title
            title = subtitle // title
        }
        CUR < .NO
        CUR.wrapItemAndSub = <li class="active first">|</li> |*| <li class="active">|</li> |*| <li class="active last">|</li>
        ACT < .CUR
    }
    2 < .1
    3 < .2
    4 < .2
}

you can quite easily adopt it to your directory starting point (and take away levels 3 & 4):

lib.field_topmenu < lib.navi.one
lib.field_topmenu {
    special = directory
    special.value = {$idMain}
    3 >
    4 >
}


aTagParams doesn´t work with shortcuts. you have to put the real pages into the sys folder than it will work.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜