简体   繁体   English

Typo3 f:if 中的流体使用条件视图助手

[英]Typo3 Fluid use Condition View helper in f:if

is there a way to use ConditionViewHelpers inside of f:if ?有没有办法在f:if中使用 ConditionViewHelpers ?

Eg (with example of VHS isInteger):例如(以 VHS isInteger 为例):

Standalone Tag works:
<vhs:condition.type.isInteger value="1">TRUE1</vhs:condition.type.isInteger>

Standalone Inline works:
{vhs:condition.type.isInteger(value:1, then:'TRUE2')}

Inline in if doesn't work:
<f:if condition="{vhs:condition.type.isInteger (value:1)}">TRUE3</f:if>

This will output这将 output

TRUE1 TRUE2

So my question is, can I use a subclass of AbstractConditionViewHelper inside a standard f:if ?所以我的问题是,我可以在标准f:if中使用AbstractConditionViewHelper的子类吗?

My ultimate goal is to combine conditions, like我的最终目标是结合条件,比如

<f:if condition="{var} == 1 && {vhs:condition.type.isInteger(value:1)}">...</f:if>

I'm using Typo3 10.4我正在使用 Typo3 10.4

Yes, you can use ViewHelpers inside a condition in f:if .是的,您可以在f:if的条件内使用 ViewHelpers。 The result of the ViewHelper will be the input for the condition. ViewHelper 的结果将是条件的输入。 However, the result of {vhs:condition.type.isInteger(value:1)} is an empty string because you haven't set a then .但是, {vhs:condition.type.isInteger(value:1)}的结果是一个空字符串,因为您还没有设置then What you need is {vhs:condition.type.isInteger(value:1, then: '1')} .你需要的是{vhs:condition.type.isInteger(value:1, then: '1')} This will result in 1 , which will be true in the condition.这将导致1 ,这在条件中为真。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM