in a TYPO3 6.1 fluid template, how to parse values from a select box?

半城伤御伤魂 提交于 2019-12-11 11:38:13

问题


I have built a small extbase extension with the extension builder in TYPO3 6.1.

One field is set up as "select". The extension builder set that up in the database as an int(11) field.

Values for that field are stored as 0,1

In the Backend, the labels can be configured in the TCA for each value.

But is there a simple way to do that for the fluid template as well?

I came around an "if" condition, but that can't be it, can it?

<f:if condition="{item.typ} == 0"><f:translate key="tx_stellenangebote_domain_model_item.unbefristet" /></f:if>
<f:if condition="{item.typ} == 1"><f:translate key="tx_stellenangebote_domain_model_item.befristet" /></f:if>

So how is this value being parsed properly in fluid?


回答1:


No, there is no simple way unless you define your "Stellenangebot" type as a true relation. But that would be an overkill. Apart from user's comment (you forgot the curly brackets) your solution is fine. I would consider using an if/then/else statement instead of two if statements.



来源:https://stackoverflow.com/questions/20381917/in-a-typo3-6-1-fluid-template-how-to-parse-values-from-a-select-box

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!