TYPO3 Frontend Error: The ViewHelper "<v:switch>" could not be resolved

TYPO3 Frontend Error: The ViewHelper "<v:switch>" could not be resolved

尝试从我的扩展程序打开一个包含 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 语句。

提前致谢!

如果您的 Typo3 版本是 8.7.19,您的 vhs 版本可能高于 2.4.0,因此切换功能已直接移动到 fluid 中。

你应该试试这样的方法:

<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