Sections and variables

Hello all,

I have a major comprehension problem right now. I would like to use variables in a section (Neos FDlow 6.3.0). I have two variables defined in my ActionController (customers and currentCustomer).
One of the two variables is null inside the Section, but still exists before it.

<f:render partial="General/CardSimple" arguments="{cardWidth: '6', cardHeader: 'Kunden', cardBody: '{f:render(section:\'cardBody\')}'}" />

<f:debug>{currentCustomer}</f:debug>
<f:debug>{customers}</f:debug>
<f:section name="cardBody">
    <f:debug>{currentCustomer}</f:debug>
    <f:debug>{customers}</f:debug>
</f:section>

Is this a normal behavior? Why one is avaible and the other not inside the section part?
Now I see two possibilities:

<f:render section="cardBody" arguments="{customers: customers, currentCustomer: currentCustomer}">

or

<f:render partial="cardBody" section="cardBody" arguments="{customers: customers, currentCustomer: currentCustomer}">

However, in both cases " Section “cardBody” does not exist." shows up.

Do you have any ideas?

Thank you very much in advanced for your help.

Best regards,

Tobias

Hi Tobias,

in your example you don’t render the section.
In Fluid Sections share the variable scope of the main template so both variables should be available if you just write

<f:render section="cardBody" />

If you specify arguments, you’ll create a new scope and have to specify all required values like

<f:render section="cardBody" arguments="{customers: customers, currentCustomer: currentCustomer}" />

…like you suggested.

If you want to pass all variables of the current scope you can use the magic _all variable like:

<f:render partial="somePartial" arguments={_all} />

PS: Speaking of “magic” – have a look at Fusion :slight_smile:

Thank you very much Bastian for your kind help!

So, if I understand you correctly, you say: both variables should be available in my section?! So, it is a strange behavior?

That depends on how you used the section. That part was not in your example