简体   繁体   中英

TYPO3 TypoScript Object in Fluid template as if condition not working

I get my data here:

lib.registriernummer = COA_INT
lib.registriernummer {
  10 = TEXT
  10.data = TSFE:fe_user|user|registriernummer
  10.stdWrap.ifEmpty = empty
}

In my fluid template I can use:

{f:cObject(typoscriptObjectPath:'lib.registriernummer') -> f:format.raw()}

which outputs '33'.

If I use the condition:

<f:if condition="{f:cObject(typoscriptObjectPath:'lib.registriernummer') -> f:format.raw()} == '33'">
  <f:then>
    number is correct
  </f:then>
  <f:else>
    number is not correct
  </f:else>
</f:if>

the output is number is not correct . Why is that?

have you tried these variants?

<f:if condition="{f:cObject(typoscriptObjectPath:'lib.registriernummer')->f:format.raw()} == 33">

<f:if condition="'{f:cObject(typoscriptObjectPath:\'lib.registriernummer\')->f:format.raw()}' == '33'">

As the information for the compare can't be cached, the resulting block can't be cached too.

Either put the block in the (typoscript) viewhelper or make the template uncached.

something like this:

lib.registriernummer = COA_INT
lib.registriernummer {
  10 = TEXT
  10.value = number is not correct
  10.override = number is correct
  10.override.if.equals.data = TSFE:fe_user|user|registriernummer
  10.override.if.value = 33
}

probably you will do more than just some text. ;-)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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