在TYPO3 6.1流体模板中,如何从选择框中解析值? [英] in a TYPO3 6.1 fluid template, how to parse values from a select box?

查看:59
本文介绍了在TYPO3 6.1流体模板中,如何从选择框中解析值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用TYPO3 6.1中的扩展构建器构建了一个小的extbase扩展.

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

将一个字段设置为选择".扩展程序构建器在数据库中将其设置为int(11)字段.

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

该字段的值存储为0,1

Values for that field are stored as 0,1

在后端中,可以在TCA中为每个值配置标签.

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?

推荐答案

不,除非您将"Stellenangebot"类型定义为真实关系,否则没有简单的方法.但这将是一个过大的杀伤力.除了用户的评论(您忘了大括号)之外,您的解决方案还不错.我会考虑使用if/then/else语句,而不是两个if语句.

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.

这篇关于在TYPO3 6.1流体模板中,如何从选择框中解析值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆