TYPO3 doesn't show any pages in submenu - typo3

In my TYPO3 I have this code for submenu
lib.subnav = COA
lib.subnav {
wrap = <ul class="nav nav-list" id="sidebar-nav">|</ul>
10 = TEXT
10.wrap = <li class="list-group-item">|</li>
#10.wrap {
# override = <li class="list-group-item current">|</li>
# override.if {
# value.data = field:uid
# equals.data = leveluid:1
# }
#}
10.data = leveltitle:1
#10.data = levelfield:1,nav_title // leveltitle:1
10.typolink.parameter.data = leveluid:1
20 = HMENU
20.wrap = |
20 {
entryLevel = 1
1 = TMENU
1 {
wrap = |
expAll = 0
NO = 1
NO.allWrap >
NO.wrapItemAndSub = <li class="list-group-item">|</li>
CUR = 1
CUR < .NO
CUR.wrapItemAndSub = <li class="list-group-item active current">|</li>
ACT = 1
ACT < .CUR
ACT.wrapItemAndSub = <li class="list-group-item active">|</li>
# Dropdown menu
IFSUB = 1
IFSUB < .NO
IFSUB.wrapItemAndSub = <li class="list-group-item">|</li>
IFSUB.ATagBeforeWrap = 1
IFSUB.stdWrap.wrap = |
CURIFSUB = 1
CURIFSUB < .IFSUB
CURIFSUB.wrapItemAndSub = <li class="list-group-item active current">|</li>
ACTIFSUB = 1
ACTIFSUB < .IFSUB
ACTIFSUB.wrapItemAndSub = <li class="list-group-item active">|</li>
}
2 = TMENU
2 {
wrap = <ul class="list-group">|</ul>
expAll = 0
NO = 1
NO.allWrap >
NO.wrapItemAndSub = <li class="list-group-item">|</li>
ACT = 1
ACT < .NO
ACT.wrapItemAndSub = <li class="list-group-item active">|</li>
CUR = 1
CUR < .ACT
CUR.wrapItemAndSub = <li class="list-group-item active current">|</li>
IFUSB < .1.IFSUB
ACTIFSUB < .1.ACTIFSUB
CURIFSUB < .1.CURIFSUB
SPC = 1
SPC.doNotLinkIt = 1
SPC.doNotShowLink = 1
SPC.allWrap = <li class="divider"></li>
}
3 < .2
# no submenus anymore
3.IFSUB >
3.ACTIFSUB >
}
}
If I wiev the source of the page I can se this line: | but no menu items.
I have tried to chage submenu.entrylevel, but nothing changes.
There a subpages, so that is not the problem.
It is TYPO3 8.7 and I know that it is terrible old, but I need this to work before an update.

Let's have an example page:
Home/Root
Page 1
Page 1.1
Page 1.1.1
Page 1.2
Page 2
Page 3
Page 3.1
Page 3.2
Page 3.2.1
Regarding entryLevel:
Default is "0" which gives us a menu of the very first pages on the site. For the tree above, the menu will contain "Page 1", "Page 2", "Page 3".
entryLevel=1 will show the pages below. So, if you are on "Page 1", the menu will show "Page 1.1." and "Page 1.2" (active rootline). On "Page 2" the menu will not show up anything, because there are no pages below Page 2. On "Home/Root" no menu will appear because there's no level 1 directly underneath.
expAll
If this is true, the menu will always show the menu on the level underneath the menu item.
Back to the pagetree: having entryLevel=0 and 20.1.expAll=1 all submenus of the third level will be expanded, not only the one of active rootline. All "Page x.x" will appear, but none of the "Page x.x.x".
For getting a full dropdown-menu, also the next level needs to be expanded: 20.2.expAll=1

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 menu: how to set "entryLevel" dynamic?

I'm trying to create a menu that displays in TYPO3 all subpages and the parent page. My problem is that I find no way to assign entryLevel dynamically.
I'm working with TYPO3 6.1
This is currently my typoscript for the menu.
lib.mainnavi = HMENU
lib.mainnavi {
entryLevel = 1
1 = TMENU
1.wrap = <ul> | </ul>
1 {
noBlur = 1
NO {
subst_elementUid = 1
allWrap = <li id="link{elementUid}" class="first">| |*| <li id="link{elementUid}">| |*| <li id="link{elementUid}" class="last">|
wrapItemAndSub = |</li>
}
ACT = 1
ACT {
subst_elementUid = 1
allWrap = <li id="link{elementUid}" class="first current first_current">| |*| <li id="link{elementUid}" class="current">| |*| <li id="link{elementUid}" class="last current last_current">|
wrapItemAndSub = |</li>
}
}
}
Below is a picture to illustrate what I want.
When I go to "1", I want to see "FAQ", "GTC (EU)" and "GTC (USA)".
When I go to "FAQ", I want to see A-J and "1" as "back".
When I go to "A", I want to see "FAQ" as "back"
I can make the "back" menu with a seccond menu and special = browse. But I can't find a way to set entryLevel dynamically
Entry level can get positive and negative values.
While the positive values are marking absolute level positions counting from the root page.
Root => 0
- Page => 1
- Page => 2
- Current Page => 3
negative values will be relative and counted from the current page back to the root
Root => -4
- Page => -3
-Page => -2
- Current Page => -1
This way you don't have to use conditions for every level, which would just bloat your caching tables.
Root => 0
- Page => 1
- Current Page => 2
Root => -3
- Page => -2
- Current Page => -1
You can adjust the entryLevel setting with a condition below your TS code. Just have a look at the documentation for the treeLevel condition.
Use it like this:
[treeLevel = 2]
lib.mainnavi.entryLevel = 2
[end]
There is a nother solution, that does not use entryLevel at all:
lib.mainnavi = HMENU
lib.mainnavi {
special = directory
special.value.field = uid
...
}
This would create a menu of pages having the UID of the current page as PID, AKA subpages of the current page.
This did the trick for me:
lib.mainnavi = HMENU
lib.mainnavi {
entryLevel = 1
special = directory
special.value.data = leveluid:-1
# your code here ...
}

Menu: wrap every X item

I am trying to wrap every 3rd item in a menu generated with TypoScript.
This is my menu:
tt_content.menu.20.4 >
tt_content.menu.20.4 < tt_content.menu.20.1
tt_content.menu.20.4.stdWrap.outerWrap = <div class="my-menu">|</div>
tt_content.menu.20.4.1.wrap = <ul>|</ul>
tt_content.menu.20.4.1.NO {
doNotLinkIt = 1
stdWrap.htmlSpecialChars = 0
stdWrap.cObject = COA
stdWrap.cObject {
# title
10 = TEXT
10 {
field = title
typolink.parameter.field = uid
typolink.ATagParams = class="more"
}
# abstract
20 = TEXT
20 {
field = abstract
htmlSpecialChars = 1
wrap = <span>|</span>
}
}
}
Via How can I apply a different wrap to every menu item? I know how to wrap every item different, is there a way to wrap three items together?
And when there are more than 3 % x = 0 items, e.g. 14, the last opening tag has to be closed with the last item.
Current output:
<ul class="csc-menu csc-menu-1">
<li>
Page 1
</li>
<li>
Page 2
</li>
<li>
Page 3
</li>
<li>
Page 4
</li>
<li>
Page 5
</li>
<li>
Page 6
</li>
<li>
Page 7
</li>
<li>
Page 8
</li>
<li>
Page 9
</li>
</ul>
Wanted output, something like this:
<div class="pack">
Page 1
Page 2
Page 3
</div>
<div class="pack">
Page 4
Page 5
Page 6
</div>
<div class="pack">
Page 7
Page 8
Page 9
</div>
<div class="pack">
Page 10
Page 11
</div>
Basically you are asking 2 questions.
But for both you might use optionSplit. [1.]
First: "wrap every 3rd item"
Your code would look like that:
tt_content.menu.20.4.1.NO.allWrap = |*| <ul>|</ul> || <ul>|</ul> || <ul class="third">|</ul> |*|
Second: "is there a way to wrap three items together"
Your code would look like that:
tt_content.menu.20.4.1.NO.allWrap = |*| <div class="threepack"> <ul>|</ul> || <ul>|</ul> || <ul>|</ul> </div> |*|
How optionSplit ist working in these cases:
You have no first and last part, so the middle part is cycled over all items.
The middle part consists of 3 subparts which are cycled too.
Hope that helped.
PS: Don't forget to accept an answer ;-)
Links:
http://wiki.typo3.org/TSref/optionSplit
The below typoscript may help you (It's for page menu to group 3 page links together and you need to modify it according to your requirements.):
page.234 = COA
page.234{
wrap = <ul> |</ul>
10 = HMENU
10.1 = TMENU
10.special = directory
10.special.value = 1
10.1 {
wrap = <li><ul>|</ul></li>
begin = 1
maxItems = 3
NO {
allWrap = <li> |</li>
}
}
20 < .10
20.1.begin = 6
30 < .10
30.1.begin = 9
# etc. etc.
}

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.