如何对每个菜单项应用不同的包装? [英] How can I apply a different wrap to every menu item?
问题描述
我试图在 TypoScript 中创建一个自定义菜单,我的想法是为每个菜单项设置一个 div
.
示例
lib.mainMenu = HMENUlib.mainMenu {入门级 = 01 = TMENU1 {NO.allWrap = <div id="forsideknap">|</div>|*|<div id="butikker">|</div>|*|<div id="nyheder">|</div>|*|<div id="arrangementer">|</div>|*|<div id="avis">|</div>}}
我创建了 5 个页面,其中只有 3 个获得了 div
.有3个相同.我该如何解决这个问题?
您正在使用 optionSplit
概念,它本身有许多不同的选项.第一次使用时可能会造成混淆.您无意中使用 |*|
分隔符定义了换行的 first、middle 和 last 部分:
第一个元素|*|中间元素|*|最后一个元素
如果中间元素不止一个,它们都会得到中间参数(butikker").并且从第三个 |*|
开始的所有内容都将被忽略.
您想要的是不同包装的简单序列.这是通过使用 ||
分隔符来实现的:
第一个元素 ||第二个元素 ||第三个元素 ||第四个元素 ||第 5 个元素 ||等等.
就你而言:
NO.allWrap = <div id="forsideknap">|</div>||<div id="butikker">|</div>||<div id="nyheder">|</div>||<div id="arrangementer">|</div>||<div id="avis">|</div>
请注意,如果您有更复杂的结构,您可以组合分隔符.
阅读更多:
I was trying to create a custom menu in TypoScript and my idea is to have a div
for each menu item.
Example
lib.mainMenu = HMENU
lib.mainMenu {
entryLevel = 0
1 = TMENU
1 {
NO.allWrap = <div id="forsideknap">|</div> |*| <div id="butikker">|</div> |*| <div id="nyheder">|</div> |*| <div id="arrangementer">|</div> |*| <div id="avis">|</div>
}
}
I have created 5 pages, and only 3 of them are getting their div
. There are 3 identical. How can I fix this problem?
You are using the optionSplit
concept, which itself has many different options. It might cause confusion when used for the first time. You unintentionally defined the first, the middle and the last part of your wrap by using the |*|
separators:
first element |*| middle element(s) |*| last element
If there is more then one middle element, they all get the middle parameter ("butikker"). And everything from the third |*|
on is ignored.
What you wanted is a simple sequence of different wraps. This is achieved by using the ||
separator:
1st element || 2nd element || 3rd element || 4th element || 5th element || etc.
In your case:
NO.allWrap = <div id="forsideknap">|</div> || <div id="butikker">|</div> || <div id="nyheder">|</div> || <div id="arrangementer">|</div> || <div id="avis">|</div>
Note that you can combine the separators if you have more complicated structures.
Read more:
on TYPO3 Docs
这篇关于如何对每个菜单项应用不同的包装?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!