TypoScript:{field:uid} 替换不起作用 |每个菜单项不同的 CSS 类 [英] TypoScript: {field:uid} replacement not working | Different CSS class per menu item
问题描述
我有一个标题菜单,并尝试为每个项目定义不同的 CSS 类.
I have a header menu and try to define different CSS classes for each item.
这就是我所拥有的:
20 = HMENU
20 {
special = directory
special.value = 107
1 = TMENU
1 {
wrap = <ul class="foo" id="mymenu">|</ul>
expAll = 1
NO = 1
NO.allWrap = <li class="first menu_{field:uid}">|</li> || <li class="menu_{field:uid}">|</li> || <li class="last menu_{field:uid}">|</li>
}
}
但在 HTML 输出中,我只是得到 class="first menu_{field:uid}"
并且没有被替换.
But in the HTML output I simply get class="first menu_{field:uid}"
and nothing is replaced.
顺便说一句:菜单中的页面条目是指向外部页面的链接.
By the way: The page entries in the menu are links to external pages.
由于我们的设计师抱怨非语言类 ID,我们现在正在滥用 body-class 属性:
As our designer complained about the non-speaking class IDs we are abusing the body-class attribute now:
NO.allWrap = <li class="first {field:bodyclass_wrap_class}">|</li> || <li class="{field:bodyclass_wrap_class}">|</li> || <li class="last {field:bodyclass_wrap_class}">|</li>
推荐答案
你必须加上NO.allWrap.insertData = 1
,然后数据才会被插入.allWrap
只是一个普通的 stdWrap
,所以 默认功能 在那里申请.
You have to add NO.allWrap.insertData = 1
, then the data will be inserted. allWrap
is just a normal stdWrap
, so the default features apply there.
顺便说一句:我认为您的选项拆分仍然是错误的.我猜你想要这样:
BTW: I think your option split is still wrong. I guess you want to have it like this:
NO.allWrap = <li class="first menu_{field:uid}">|</li> |*| <li class="menu_{field:uid}">|</li> |*| <li class="last menu_{field:uid}">|</li>
这篇关于TypoScript:{field:uid} 替换不起作用 |每个菜单项不同的 CSS 类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!