简体   繁体   English

Typo3 Fluid:elseif内联符号

[英]Typo3 Fluid: elseif inline notation

Is there an inline notation for the following example? 是否有以下示例的内联表示法?

<f:if condition="{value}==1">
    <f:then>Value is 1</f:then>
    <f:else if="{value}==2">Value is 2</f:else>
</f:if>

Thanks for your help 谢谢你的帮助

probably it will be the cascading of if -viewhelpers: 可能它会是if -viewhelpers的级联:

{f:if(condition:'{value}==1', 
    then:'Value is 1', 
    else:'{f:if(condition:\'{value}=2\', then:\'Value is 2\')}'
)}

with the usual drawback of escaping string-delimiter for stacked inline viewhelpers. 通常的缺点是为堆叠的内联视图转义字符串分隔符。

your condition will default to 'Value is 2' although the value might not be ... this is not true, anyhow a bit more complete: 你的条件将默认为'值为2',虽然值可能不是......这不是真的,无论如何更完整:

<f:if condition="{value}==1">
  <f:then>Value is 1</f:then>
  <f:else if="{value}==2">Value is 2</f:else>
  <f:else>Value is not valid</f:else>
</f:if>

simple inline annotation that does not output anything if the two conditions are not met: 如果不满足这两个条件,则不会输出任何内容的简单内联注释:

{f:if(condition:'{value}==1',
  then: 'Value is 1',
  else: '{f:if(condition:\'{value}==2\',then: \'Value is 2\')}'
)}

add the else clause in the second condition: 在第二个条件中添加else子句:

{f:if(condition:'{value}==1',
  then: 'Value is 1',
  else: '{f:if(condition:\'{value}==2\',
    then: \'Value is 2\',
    else: \'Value is not valid\'
  )}'
)}

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

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