[英]Typo3 menu with anchors
使用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使用頁面樹來創建導航。 現在我想從頁面本身添加錨點到我的導航。 我發現這樣做的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 >
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.