【问题标题】:TYPO3 Frontend Error: The ViewHelper "<v:switch>" could not be resolvedTYPO3 前端错误:无法解析 ViewHelper“<v:switch>”
【发布时间】:2018-09-20 14:17:15
【问题描述】:

尝试从我的扩展程序中打开一个包含 html 文件的站点,出现此错误:(TYPO3 版本 8.7.19)

1407060572: Fluid parse error in template 
partial_Video/VideoSlide_016cfc0cd210899384d5d10b02b3336b438691df, line 47 at 
character 1. Error: The ViewHelper "<v:switch>" could not be resolved. Based on 
your spelling, the system would load the class 
"FluidTYPO3\Vhs\ViewHelpers\SwitchViewHelper", however this class does not 
exist. (error code 1407060572). Template source chunk: <v:switch value=" 
{fegroup.uid}">

根据报错信息,Viewhelper和switch语句有问题。

这里是 using 命名空间

{namespace v=FluidTYPO3\vhs\ViewHelpers}

这里是switch语句的代码:

<f:if condition="{v:variable.get(name: 'access', useRawKeys: 1)}">
    <!-- ... -->
    <f:else>
        <f:for each="{video.fegroupUID}" as="fegroup" iteration="iterator">
            <v:switch value="{fegroup.uid}">
                <v:case case="2" break="TRUE">
                        <div class="thumbnailcontainer_overlay">
                            <p><f:translate key="thumbnail_justforregisteredusers"/></p>
                        </div>
                </v:case>
                ...

无论我改变什么,我总是得到同样的错误,如上所示。即使我注释掉负责的部分,这让我很困惑! 我已经清除了所有 chaches(在安装工具中),尝试了其他命名空间并仔细检查了我的 switch 语句。

提前致谢!

【问题讨论】:

    标签: php typo3-8.x typo3-extensions


    【解决方案1】:

    如果您的 Typo3 版本是 8.7.19,那么您的 vhs 版本可能高于 2.4.0,因此开关功能已直接移至流体中。

    你应该尝试这样的事情:

    <f:switch expression="{person.gender}">
      <f:case value="male">Mr.</f:case>
      <f:case value="female">Mrs.</f:case>
      <f:case default="TRUE">Mrs. or Mr.</f:case>
    </f:switch>
    

    更多信息:https://fluidtypo3.org/viewhelpers/fluid/master/SwitchViewHelper.html

    【讨论】:

    • 没问题,随时关注我们!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-01-21
    • 1970-01-01
    • 1970-01-01
    • 2017-01-20
    • 2021-03-16
    相关资源
    最近更新 更多