[FLOW3-general] Multiple conditions in if view helper
Bastian Waidelich
bastian at typo3.org
Mon Oct 22 20:03:54 CEST 2012
David Sporer wrote:
Hi David,
> I have a Form where I'm displaying fields. Every field has a field type
> assigned.
> If a field has a certain field type I need to display additional input
> fields.
> [...]
> Normal fields contain only one value - special fields must also contain a
> label, a change message and a key value.
You probably create the form from some object (= your model)
Let's say you have a model "Passbook" with a m:m relation to "fields".
One field could have the properties "value", "label", "changeMessage"
and "keyValue" and the latter could be empty for basic fields and
specified for special fields (you could also use two different classes
and "single table inheritance").
Then, in your fluid template, you could simly write:
<f:if condition="{field.label}">
{field.label}
</f:if>
Alternatively you could add a getter to the Field model
"hasExtendedFields()" that returns TRUE or FALSE.
HTH
--
Bastian Waidelich
TYPO3 Core Team Member
TYPO3 .... inspiring people to share!
Get involved: typo3.org
More information about the FLOW3-general
mailing list