0
votes

I'm trying to set a variable in a Fluid template. I try to divide something by 2 :

<f:variable name="hmc">{menu->f:count()} / 2</f:variable>

It does not work because I get a string instead of a numeric result.

1
are you sure you need to calculate? most situations also can be handled with the iterator variable from the f:for VH. see manual, and example - Bernd Wilke πφ

1 Answers

0
votes

I think you can't do it in a one-liner. You have to count first and then do the math.

<f:variable name="count">{menu -> f:count()}</f:variable>
<f:variable name="hmc">{count / 2}</f:variable>