How to split menu in parts with typoscript - typo3

I have a Typoscript menu with a lot of items and want to split it into several blocks of 6 items each.
My typoscript looks like this at the moment:
lib.mainnav = HMENU
lib.mainnav {
1 = TMENU
1 {
wrap = <ul>|</ul>
expAll = 1
NO = 1
NO.wrapItemAndSub = <li>|</li>
NO.stdWrap.htmlSpecialChars = 1
NO.ATagParams = name = "{field:title}"
NO.allStdWrap.insertData = 1
}
[ ... ]
}
After every 6th item a </ul><ul> should be inserted here. I have already tried a lot of things, but have not yet reached the desired result.
Does anyone have a tip for me?
Thanks in advance for your help!

NO.wrapItemAndSub = <li>|</li> || <li>|</li> || <li>|</li> || <li>|</li> || <li>|</li> || <li>|</li></ul><ul> |*| |*|
Keep in mind that you will have an empty <ul></ul> if you have a multiple of 6 entries in your menu.

Related

TYPO3: typoscript wrap two elements with div

is it possible to wrap always two <li> elements in a div in typoscript?
at the moment it looks like this:
navStatic = HMENU
navStatic {
special = directory
special.value = 2
excludeUidList = 2
1 = TMENU
1 {
expAll = 1
wrap = <ul class="headernavmenu">|</ul>
noBlur = 1
NO = 1
NO {
ATagTitle.field = title
wrapItemAndSub = <li>|</li>
allWrap = | I |*| | I |*| |
}
ACT < .NO
ACT.ATagParams = class="active_static"
}
}
thanks in advance
This addition to your TypoScript should do the job, just when an odd number of li-elements is in the list the last single li-element is not wrapped.
NO.wrapItemAndSub.outerWrap = <div class="two-list-elements"> || || </div>
Be advised that this HTML-solution is error-prone as browsers might interpret it different or not at all because the HTML is not standard-conform.

Typo3: Output of all 2nd level pages as menu independent of active pages

I want to create a menu of all 2nd level items at once in separate DIVs (outside the first level menu) - independent of the active page. Do you have an hint for me? Thank you very much for your help!!
don't forget to configure
1.expAll = 1
in your typoscript menu definition
I think you are looking something like this:
lib.menu = COA
lib.menu {
# Menu of first Level
10 = HMENU
10.entryLevel = 0
10.1 = TMENU
10.1.wrap = <ul> | </ul>
10.1.NO.allWrap = <li>|</li>
# Menu of all second levels
20 = HMENU
20.entryLevel = 0
20.1 = TMENU
20.1.expAll = 1
20.1.NO.doNotLinkIt = 1
20.1.NO.doNotShowLink =1
20.1.IFSUB = 1
20.1.IFSUB.doNotLinkIt = 1
20.1.IFSUB.allWrap = <h4>2°lv (|) </h4>
20.2 = TMENU
20.2.wrap = <ul> | </ul>
20.2.NO.allWrap = <li> | </li>
}
Thank you for your answers! I found a similar solution like the one Cristian Buja posted, that works fine for me. Here's the code if someone have the same issue: `lib.subnav = HMENU
lib.subnav {
1 = TMENU
1 {
expAll = 1
NO.doNotShowLink = 1
IFSUB = 1
IFSUB.doNotShowLink = 1
IFSUB.allWrap = <div id="s{elementUid}" class="nv-sub-wrapper"><div class="nv-sub-menu clearfix">|
IFSUB.wrapItemAndSub = |<div class="nv-sub-info"></div></div></div>
IFSUB.subst_elementUid = 1
}
2 = TMENU
2 {
wrap = <ul>|</ul>
NO = 0
NO {
ATagParams = data-description="{field:abstract // field:subtitle // field:title}"
ATagParams.insertData = 1
wrapItemAndSub = <li>|</li>
}
}
}`

TYPO3 mark root page as active

In my TYPO3 6.2.31 (I know...) page I have the following typoscript for the navigation:
NAVIMAIN = HMENU
NAVIMAIN.entryLevel = 0
#NAVIMAIN.excludeUidList =
NAVIMAIN {
1 = TMENU
1 {
expAll = 1
wrap = <ul class="sf-menu">|</ul>
noBlur = 1
NO = 1
NO.ATagTitle.field = title
NO.wrapItemAndSub = <li>|</li>
ACT = 1
ACT.wrapItemAndSub = <li class="active"> |</li>
}
2 = TMENU
2 {
expAll = 1
maxItems = 10
wrap = <div class="sf-mega">|</div>
NO = 1
NO {
ATagTitle.field = title
wrapItemAndSub = <div class="sf-mega-section">|</div>
stdWrap.wrap = |
ATagParams = class="headermega"
stdWrap.htmlSpecialChars = 1
doNotLinkIt = 0
}
}
3 = TMENU
3 {
expAll = 1
maxItems = 20
wrap = <ul>|</ul>
NO = 1
NO {
ATagTitle.field = title
linkWrap = <li>|</li>
}
ACT = 1
ACT {
wrapItemAndSub = <li>|</li>
ATagParams = class="active"
}
}
#4 < .3
}
All sub pages are marked as aktive when they are clicked ... but the root node not ... so I've added this as well:
[globalVar = TSFE:id=1]
NAVIMAIN.alwaysActivePIDlist = 1
[global]
[globalVar = TSFE:id=1]
NAVIMAIN.alwaysActivePIDlist = 60
[global]
But this does hasn't any effect as well.
What can I do to mark the root node as active as well?
Thanks in advance
After some Teamviewer investigations we found the source of the problem in the Typoscript structure. The [globalVar] condition was placed inside page.20.marks {} but conditions must be placed outside of any nesting.
Moving the condition outside of the nesting and correcting the path, everything worked fine.
[globalVar = TSFE:id=1]
page.20.marks.NAVIMAIN.alwaysActivePIDlist = 60
[global]
As Bernd said, [page:uid = 1] would be the better condition, too.
If you want both pages to be active you need to do another construct as in your way the second assignement would overwrite the first one.
[globalVar = TSFE:id=1]
NAVIMAIN.alwaysActivePIDlist := addToList(1)
[global]
[globalVar = TSFE:id=1]
NAVIMAIN.alwaysActivePIDlist := addToList(60)
[global]
In general you would join the two statements.
Another change I would consider: use another condition as TSFE will become obsolete in the near future:
[page:uid = 1]
NAVIMAIN.alwaysActivePIDlist = 1,60
[global]

TYPO3 excludeUidList is there an includeUidList

Have search the net, for a solution where i have a navi TS file that show a Menu.
here i only want to show 2 links, the links are a Main root page and a sub page, so my question is.
If i dont want to excludeUidList all the 7-9 Uid, is there a way to make a includeUidList ?
bc i can't get this to work, it showing all the Uid links.
lib.leftNavi = HMENU
lib.leftNavi.entryLevel=0
lib.leftNavi.includeUidList = 4,8
lib.leftNavi.1 = TMENU
lib.leftNavi.1 {
wrap = <div id="leftMenu"><ul class="L1"><li><ul>|</ul></li></ul></div>
expAll = 0
NO = 1
NO.allWrap = <li>|</li>
NO.stdWrap.wrap = <span>|</span>
RO < .NO
RO = 1
CUR < .NO
CUR = 1
CUR.allWrap = <li class="current">|</li>
CUR.stdWrap.wrap = <span>|</span>
CUR.ATagParams =
ACT < .CUR
}
No, there is no includeUidList, see the reference at http://docs.typo3.org/typo3cms/TyposcriptReference/latest/ContentObjects/Hmenu/.
But you can use a HMENU with the "special" property: http://docs.typo3.org/typo3cms/TyposcriptReference/latest/ContentObjects/Hmenu/#hmenu-special-property
20 = HMENU
20.special = list
20.special.value = 35, 56
This will generate a menu with page 35 and 36.

Typoscript navigation setup

I am new to typo3 and I have to setup a navigation. 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.