[英]Typo3 Fluid: elseif inline notation
是否有以下示例的內聯表示法?
<f:if condition="{value}==1">
<f:then>Value is 1</f:then>
<f:else if="{value}==2">Value is 2</f:else>
</f:if>
謝謝你的幫助
可能它會是if
-viewhelpers的級聯:
{f:if(condition:'{value}==1',
then:'Value is 1',
else:'{f:if(condition:\'{value}=2\', then:\'Value is 2\')}'
)}
通常的缺點是為堆疊的內聯視圖轉義字符串分隔符。
你的條件將默認為'值為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>
如果不滿足這兩個條件,則不會輸出任何內容的簡單內聯注釋:
{f:if(condition:'{value}==1',
then: 'Value is 1',
else: '{f:if(condition:\'{value}==2\',then: \'Value is 2\')}'
)}
在第二個條件中添加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.