TYPO3 - Fluid returns string & ldquo; Array & rdquo;

advertisements

I have this in my template:

<v:iterator.explode content="<f:format.nl2br>{artnumbers.qualitynumber.certificates}</f:format.nl2br>" glue="<br />" as="expCertificates">

if artnumbers.qualitynumber.certificates is empty, it returns teh string "array".

Is that a bug?


You are using the ViewHelper. This ViewHelper replaces newlines in a string (!) with
tags. You cannot use it for an array and that's why it returns "array".

I don't know why you need the explode viewHelper. Why don't you just iterate through your certificates?

<f:for each="{artnumbers.qualitynumber.certificates}" as="certificate">
    {certificate}<br />
</f:for>

EDIT: If certificates is a string containing newlines, use the newline as glue for explode:

<v:iterator.explode content="{artnumbers.qualitynumber.certificates}" glue="\n" as="expCertificates">

You could also try to use CONSTANT:LF in glue as suggested in the documentation of the ViewHelper: https://fedext.net/viewhelpers/vhs/master/Iterator/ExplodeViewHelper.html