0

我有一个 HTML 模板,我使用 automaketemplate 制作了一个typo3 模板。在这个 HTML 中,我有一个这样的 div 设置

 <div class="bigPostItWrap">1 
                <div class="postit">2
                    <div class="postit_tesa">3</div>
                    <div class="postItWrap">4
                        <ul class="menusmall">5
                            <li>* Team</li>6
                            <li>* something else</li>
                            <li>* Third point</li>
                        </ul>
                    </div>
                </div>
    </div>

UL 应包含辅助导航,仅在选择某个主导航对象时显示。由于它位于屏幕上的其他位置,因此我将其设置为像这样的独立菜单

postitMenu = HMENU
postitMenu {
  # show the submenue relative to this entry level (?)
  entryLevel = 1
  # the first level of the menu is a text menu
  1 = TMENU
  # wrap the whole menu with <ul class="menu"> | </ul>
  1.wrap = <ul class="menusmall"> | </ul>

  # enable the "no"rmal state
  1.NO = 1
  # for the normal state, wrap it in li
  1.NO.linkWrap = <li>* |</li>

  #enable active state
  1.ACT = 1
  #copy all properties from normal state to active state
  1.ACT < .NO
  # disable the link for the active menu-point
  1.ACT.doNotLinkIt = 1
  # wrap the active menulink in li with the class = "active"
  1.ACT.allWrap = <li class="active">* |</li>
}

所有这一切都很好,菜单只显示在正确的主菜单条目上。但是外部 divpostit包含一个背景图像(您可能会猜到,它是一个 postIt),而 postit_tesa 在 postit 顶部显示一条胶带。当然,如果我不显示二级菜单,我也不想渲染 postIt 和胶带。

由于我对typoScript 还很陌生,所以我不知道如何实现这一点。而且我不知道如何用谷歌搜索,至少我没有找到任何解决方案。我想,如果我围绕它制作 bigPostItWrap,我可能会做类似的事情

if there is an li-element, 
render the subpart bigPostItWrap, 
else, don't render it

但我不能落后于 ts-if,或者做一些完全错误的事情。任何提示都值得赞赏。对于专业人士来说这可能是荒谬的容易,但我无法弄清楚,我从前天开始尝试 -.-

谢谢!

4

1 回答 1

0

对于任何面临同样问题的人:我是用作弊的方式做到的。事实上有两种方法。

首先,我简单地制作了外部 wrap-div,并为其分配了所有其他代码,然后在此代码中构建菜单,如果页面 ID 是我想要的。那行得通,但并不好。

第二种可能更清洁的方法是通过 css.. 只需将包装器的可见性设置为隐藏即可。比让typo3给你的body标签在body标签内的UID

# generate a bodyTag with the current page UID
page.bodyTag >
page.bodyTagCObject = TEXT
page.bodyTagCObject.field = uid
page.bodyTagCObject.wrap = <body id="pid-|">

在您的 CSS 中,创建一个新的选择器(假设第 3 页是您希望菜单出现的那个)

#pid-3 .your-wrappers-name {
visibility: visible;
}

你去吧。该 Div 将仅在具有 UID 3 的页面上可见。

于 2011-08-11T07:57:16.530 回答