[英]TYPO3 different layout in TMENU for a special UID (2 TMENU inside 1 HMENU)
I try to setup a Menu in TYPO3 which got a fixed layout and style. 我尝试在TYPO3中设置一个具有固定布局和样式的菜单。 But there is one UID for which I have to set other styles and other wrappings.
但是我必须为其设置一个其他样式和其他包装的UID。
I tried to use override fpr allWrap, this works well. 我尝试使用override fpr allWrap,效果很好。 But wrap.override won't work :(
但是wrap.override将不起作用:(
For the reason that I have three levels inside the menu, I think about using the levelUID:1 to check which menupoint actually has to be rendered. 由于菜单内有三个级别,因此我考虑使用levelUID:1来检查实际上必须呈现的菜单点。 But how can I access the LEVELUID:1 inside a Menu?
但是,如何在菜单内访问LEVELUID:1?
Maybe there are better / other solutions? 也许有更好的/其他解决方案? At the moment, I splitted those two menus up into two separated scripts.
此刻,我将这两个菜单分成了两个单独的脚本。 This can't be as it makes a positioning inside the menu impossible.
这不可能,因为它使菜单内的定位变得不可能。
the normal menu: 普通菜单:
lib.field_mainnav = HMENU
lib.field_mainnav {
entryLevel = 0
excludeUidList = {$featureMenuUid}
wrap = <ul class="sf-menu fixed" id="menu">|
1 = TMENU
1 {
expAll = 1
NO.stdWrap.wrap = <span> | </span>
NO.linkWrap = <li>|</li>
IFSUB = 1
IFSUB.allWrap = <li class="dropdown">|<ul>
IFSUB.stdWrap.wrap = <span> | </span>
ACTIFSUB = 1
ACTIFSUB.allWrap = <li class="current dropdown">|<ul>
ACTIFSUB.stdWrap.wrap = <span> | </span>
ACT = 1
ACT.allWrap = <li class="current">|<ul>
ACT.stdWrap.wrap = <span> | </span>
}
2 = TMENU
2 {
expAll = 1
wrap = |</ul></li>
NO.linkWrap = <li>|</li>
IFSUB = 1
IFSUB.allWrap = <li class="dropdown">|<ul>
}
3 = TMENU
3 < .2
4 = TMENU
4 < .2
}
And the special menu for the site with UID 155 (and all subpages of it) 以及具有UID 155的网站的特殊菜单(及其所有子页面)
lib.field_featurenav = HMENU
lib.field_featurenav {
wrap=|</div></ul>
special = directory
special.value = {$featureMenuUid}
1 = TMENU
1 {
expAll = 1
NO.stdWrap.wrap = <span> | </span>
NO.linkWrap = <li>|</li>
IFSUB = 1
IFSUB.allWrap = <li>| <div class="sf-mega">
IFSUB.stdWrap.wrap = <span> | </span>
ACTIFSUB = 1
ACTIFSUB.allWrap = <li>| <div class="sf-mega">
ACTIFSUB.stdWrap.wrap = <span> | </span>
ACT = 1
ACT.allWrap = <li>| <div class="sf-mega">
ACT.stdWrap.wrap = <span> | </span>
}
2 = TMENU
2 {
expAll = 1
wrap = <div class="sf-mega-section"><ul>|</li>
NO.linkWrap = <li>a|e</li>
IFSUB = 1
IFSUB.allWrap = <li>|
IFSUB.stdWrap.cObject = COA
IFSUB.stdWrap.cObject {
10 = TEXT
10.field = tx_pricons_pr_icons
10.wrap = <!!=|></i>
20 = TEXT
20.field = title
20.wrap = |
}
}
3 = TMENU
3 {
expAll = 1
wrap = <li>|</li></ul></div><div class="sf-mega-section"><ul>
NO.linkWrap = <li>|</li>
NO.stdWrap.cObject = COA
NO.stdWrap.cObject {
10 = TEXT
10.field = tx_pricons_pr_icons
10.wrap = <!!=|></i>
20 = TEXT
20.field = title
20.wrap = |
}
}
4 = TMENU
4 < .2
}
EDIT: I think I should do something like this: 编辑:我认为我应该做这样的事情:
NO{
linkWrap = <li>|</li>
if{
value.data = leveluid : 1
IsInList = {$featureMenuUid}
stdWrap.Wrap = do another kind of wrap|to this element
}
}
How can I prove the leveluid :1. 我如何证明leveluid:1。 and if it matches the featureMenuId do an override.
如果它与featureMenuId相匹配,则进行覆盖。
Is there no possibility to get the Leveluid : 1 of the actual {field:uid} ? 是否有可能获得实际{field:uid}中的Leveluid:1?
This would be solving my problem but I found nothing. 这将解决我的问题,但我什么也没找到。
Maybe using a case object with the key on the uid? 也许使用带有uid键的case对象?
Like this: 像这样:
lib.nav = HMENU
lib.nav {
entryLevel = 0
1 = TMENU
1 {
expAll = 1
NO = 1
NO.stdWrap.wrap = <span class="foo bar">|</span>
NO.stdWrap.override.cObject = CASE
NO.stdWrap.override.cObject {
key.field = uid
18 = TEXT
18 {
field = title
wrap = <span class="special">|</span>
}
}
}
}
Answer to your comment: 回答您的评论:
Maybe cou can check the current rootline level of the page? 也许cou可以检查页面的当前rootline级别?
Like this: 像这样:
key.cObject = TEXT
key.cObject {
data = level
}
With data = level you will get the current level of the page. 使用data = level,您将获得页面的当前级别。
http://docs.typo3.org/typo3cms/TyposcriptReference/DataTypes/Gettext/Index.html#level http://docs.typo3.org/typo3cms/TyposcriptReference/DataTypes/Gettext/Index.html#level
Edited Answer to my comment: (Aug 28 at 19:35) 编辑对我的评论的答案:(8月28日19:35)
NO {
wrapItemAndSub = <li>|</li>
wrapItemAndSub.override = <li class="otherWrap">|</li>
wrapItemAndSub.override.if {
value = {$featureMenuUid}
equals.field = uid
}
}
What you should know, is that 你应该知道的是
wrapItemAndSub
is from type stdWrap. 来自stdWrap类型。
And 和
linkWrap
is NOT from type stdWrap. 不是来自stdWrap类型。 So you cant use any stdWrap property there.
因此,您不能在那里使用任何stdWrap属性。 Thats because i used wrapItemAndSub.
那是因为我使用了wrapItemAndSub。
I hope I explained it clearly enough. 我希望我解释得足够清楚。
If I gave a totally wrong answer, just let me know.. 如果我给出了完全错误的答案,请告诉我。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.