gpt4 book ai didi

menu - 带 anchor 的 Typo3 菜单

转载 作者:行者123 更新时间:2023-12-04 21:13:47 26 4
gpt4 key购买 nike

我需要帮助使用 Typo3 构建菜单。目前我在 TS 中像这样构建我的菜单:

TopNavigation = HMENU
TopNavigation {
special = directory
special.value = 3
entryLevel = 1
1 = TMENU
1.expAll = 1
1.NO = 1
1.NO.wrapItemAndSub = <li class="parent"> | </li>

2 < .1
2.expAll = 0
2.NO = 1
2.NO.ATagBeforeWrap = 1
2.NO.wrapItemAndSub = <li> | </li>
2.wrap = <ul class="dropdown"> | </ul>
}

但是像这样,Typo3 使用页面树来创建导航。现在我想将页面本身的 anchor 添加到我的导航中。我发现这样做的 TS 看起来像这样:
AnchorNavigation = CONTENT
AnchorNavigation {
table = tt_content
select {
pidInList = this
orderBy = sorting
where = colPos=0 AND sectionIndex=1
languageField=sys_language_uid
}
wrap = <ul>|</ul>
renderObj = TEXT
renderObj {
field = header
dataWrap= <li><a href="#c{field:uid}">|</a> </li>
}
}

这工作正常,但我如何将我的这些结合起来?

最后,我想要这样的东西:
Parent Page 1
Parent Page 2
-> Anchor 1
-> Anchor 2
-> Anchor 3
-> Childpage 1
Parent Page 3
-> Anchor 1
-> Anchor 2
-> Anchor 3
Parent Page 4

我希望有人可以帮助我。

最佳答案

查看 TMENU 项目的 TSref:http://docs.typo3.org/typo3cms/TyposcriptReference/MenuObjects/Tmenuitem/Index.html

有一个名为“after”的属性可用于在当前菜单项之后和呈现当前菜单项的子页面之前插入任何 TS 对象。

这个解决方案有点hackish(关于包装),但你会明白的;-)

page.5 = HMENU
page.5 {
special = directory
special.value = 3
entryLevel = 1
1 = TMENU
1.wrap = <ul>|</ul>
1.expAll = 1
1.NO = 1
1.NO.wrapItemAndSub.cObject = TEXT
1.NO.wrapItemAndSub.cObject.value = <li class="parent">|</ul></li>
1.NO.after.cObject = COA
1.NO.after.cObject {
# wrap all section links and subpages links.
# hint: </ul> is done by 1.NO.wrapItemAndSub
10 = TEXT
10.value = <ul class="dropdown">

20 = CONTENT
20 {
table = tt_content
select {
pidInList.field = uid
orderBy = sorting
where = colPos=0 AND sectionIndex=1
languageField=sys_language_uid
}
renderObj = TEXT
renderObj {
field = header
typolink.parameter.field = pid
typolink.section.field = uid
dataWrap= <li class="section-link">|</li>
}
}
}
2 < .1
2.wrap >
2.expAll = 0
2.NO = 1
2.NO.ATagBeforeWrap = 1
2.NO.wrapItemAndSub >
2.NO.wrapItemAndSub = <li class="subpage-link">|</li>
2.NO.after >
}

关于menu - 带 anchor 的 Typo3 菜单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29101315/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com