TYPO3 8.7-如何在使用EXT:felogin登录之前隐藏导航标头中的元素



我找不到TYPO3 Fluid模板问题的解决方案。

在导航标题模板中,我有一个搜索表单和一个注销链接。

<div class="suche">
<f:form action="search" method="post" controller="Search" extensionName="indexedsearch" pageUid="61" pluginName="Pi2">
<f:form.textfield name="search[sword]" value="{sword}" class="quicksearch-sword" placeholder="search" />
<button type="submit" name="search[submitButton]" class="btn">
<i class="glyphicon glyphicon-search"></i>
</button>
</f:form>
<p>
<div class="logout">
<f:link.page pageUid="1" additionalParams="{logintype:'logout'}">Logout</f:link.page>
</div>
</p>
</div>

我如何告诉页面,这两个元素也应该隐藏,直到用户使用EXT:felogin登录?

该模板以这种方式包含在默认页面模板中:

<f:render partial="Navigation/Main" arguments="{_all}" />

我想一个简单的显示:两个div中的none/show就足够了,但我不知道如何做到这一点。(我必须承认,我不是TypoScript方面最大的专家(。

任何建议都将非常有帮助和感激。

您可以使用<f:security.ifAuthenticated>视图辅助对象。你可以在这里看到更多:

https://docs.typo3.org/other/typo3/view-helper-reference/8.7/en-us/typo3/fluid/TYPO3_8-7/Security/IfAuthenticated.html

示例:

<f:security.ifAuthenticated>
<f:then>
shown when a user logged in
</f:then>
<f:else>
shown when a user is not logged in
</f:else>
</f:security.ifAuthenticated>

最新更新