TYPO3不显示子菜单中的任何页面。

huangapple go评论46阅读模式
英文:

TYPO3 doesn't show any pages in submenu

问题

在我的TYPO3中,我有以下子菜单的代码:

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.data = leveltitle:1
    10.typolink.parameter.data = leveluid:1

    20 = HMENU
    20.wrap = |
    20.entryLevel = 1
    20 {
        1 = TMENU
        1.wrap = |
        1.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>

        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>
    2.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
3.IFSUB >
3.ACTIFSUB >

如果我查看页面源代码,我可以看到这行:<ul class="nav nav-list" id="sidebar-nav">|</ul> 但没有菜单项。我已经尝试过更改submenu.entryLevel,但没有变化。子页面是存在的,所以这不是问题。

这是TYPO3 8.7版本,我知道这已经非常老了,但在升级之前我需要让它工作。

英文:

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: <ul class="nav nav-list" id="sidebar-nav">|</ul> 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.

答案1

得分: 1

关于entryLevel

默认值为"0",这将显示站点上第一个页面的菜单。对于上面的树,菜单将包含"Page 1","Page 2","Page 3"。

entryLevel=1将显示下面的页面。所以,如果你在"Page 1"上,菜单将显示"Page 1.1."和"Page 1.2"(活动根目录)。在"Page 2"上,菜单将不显示任何内容,因为"Page 2"下面没有页面。在"Home/Root"上,不会出现菜单,因为直接下面没有一级页面。

expAll

如果为真,菜单将始终显示菜单项下一级的菜单。

回到页面树:使用entryLevel=020.1.expAll=1,第三级的所有子菜单都会展开,而不仅仅是活动根目录的子菜单。所有"Page x.x"都会显示,但"Page x.x.x"都不会显示。

要获得完整的下拉菜单,下一级也需要展开:20.2.expAll=1

英文:

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

huangapple
  • 本文由 发表于 2023年2月14日 19:29:08
  • 转载请务必保留本文链接:https://go.coder-hub.com/75447193.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定