[Flow] Count specific value

Bastian Waidelich bastian at typo3.org
Fri May 8 13:31:34 CEST 2015


On 08.05.15, at 07:51, Patric Eckhart wrote:

Hi Patric,

> How can I count the number of {orderPosition.manufacturer} in the
> following Fluid Template?

If manufacturer is countable (i.e. an array or an object implementing 
the \Countable interface) you can simply use the *CountViewHelper*:

{orderPosition.manufacturer -> f:count()}

But, again, try to centralize such logic into your model. If it is easy 
to work with your PHP domain models from PHP, it will be easy to work 
with them in Fluid, too. And as a result your templates will be *much* 
easier to comprehend and maintain.

-- 
Bastian Waidelich


More information about the Flow mailing list