使用TYPO3 8中的数据处理器

问题描述 投票:2回答:3

我尝试使用TYPO3 8中的数据处理器进行菜单制作。

我的T​​ypoScript脚本中有此代码:

page = PAGE
page{
  10 = FLUIDTEMPLATE
  10 {
      file = fileadmin/abis/templates/BootstrapTmpl.html
      partialRootPath = fileadmin/abis/Partials/
      layoutRootPath =  fileadmin/abis/Layouts/
  }
  dataProcessing {
    10 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor
    10 {
      entryLevel= 0
      excludeUidList = 27,30,31
      levels = 5
      #includeSpacer = 1
      titleField = nav_title // title
      as = huhu
    }
  }
  ...
}

以及本节的一部分:

<f:section name="myMenu" >
    <f:debug title="title">{huhu}</f:debug>
    <f:cObject typoscriptObjectPath="obj.logo" />
    <ul class="nav navbar-nav navbar-left">
        <f:for each="{huhu}" as="menuItem">
             <li>
                {menuItem.text}
                <f:if condition="menuItem.subItems">
                    <f:render section="myMenu" arguments="{myMenu: menuItem.subItems}" />
                </f:if>
            </li>
        </f:for>
    </ul>
</f:section>

我的HTML输出为空。变量{huhu}为空。而且我不知道为什么。有人有主意吗?

typo3 typoscript fluid typo3-8.7.x
3个回答
7
投票

尝试将您的dataProcessing放入page.10

page = PAGE
page {
    10 = FLUIDTEMPLATE
    10 {
        file = fileadmin/abis/templates/BootstrapTmpl.html
        partialRootPath = fileadmin/abis/Partials/
        layoutRootPath =  fileadmin/abis/Layouts/

        dataProcessing {
            10 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor
            10 {
                entryLevel= 0
                excludeUidList = 27,30,31
                levels = 5
                #includeSpacer = 1
                titleField = nav_title // title
                as = huhu
            }
        }
    }
}

4
投票

首先,“ dataProcessing”必须在page.10内完成。其次,您必须在“ f:render”标签中将参数传递给您的部分。不知道是否要这样做,因为示例代码中缺少该部分。


0
投票

我有一个类似的问题,我的打字代码是正确的。但是,我忘了添加

arguments="{_all}"

通话时

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

在我的布局中。您也可以在Partial中使用<f:debug>{huhu}</f:debug>,如果huhu为null,则可能已经忘记了arguments="{_all}"

© www.soinside.com 2019 - 2024. All rights reserved.