Sebastian
Sebastian

Reputation: 930

TYPO3 - inline FLUID - add a Space

I am searching for a Example or Solution. I have a inline for each and I need a Space after the Items

{items -> f:for(each: '{field.referenzTeaserCategory -> dce:explode(delimiter:\',\')}', as: 'items', iteration: 'iterator')}

The Output is "cat1cat2cat3" but i need the Output with a Space, like this: "cat1 cat2 cat3"

Thanks for a Solution.

Upvotes: 0

Views: 725

Answers (3)

René Pflamm
René Pflamm

Reputation: 3354

Use an Partial File to solve it:

MyPartial.html

<f:spaceless>
  <f:for each="{field.referenzTeaserCategory -> dce:explode(delimiter:',')}" as="item" iteration="iterator">
    {item}
  </f:for>
</f:spaceless>

You can also use Sections within your template:

MyTemplate.html

<div class="{f:render(section:'myCategories', arguments:_all)}"></div>

<f:section name="MyCategories"><f:spaceless>
  <f:for each="{field.referenzTeaserCategory -> dce:explode(delimiter:',')}" as="item" iteration="iterator">
    {item}
  </f:for>
</f:spaceless></f:section>

Upvotes: 1

Kami Yang
Kami Yang

Reputation: 427

Haven't used an inline foreach yet but maybe an whitespapce after the closing curly bracket will work.

like this: '{field.referenzTeaserCategory -> dce:explode(delimiter:\',\')} '

Upvotes: 0

Bernd Wilke πφ
Bernd Wilke πφ

Reputation: 10791

I don't think that you can build this with inline notation with normal fluid.
You need to use a viewhelper which concatenates your variable items with a string ' '. You may introduce this VH or use tag notation:

<f:for each="{field.referenzTeaserCategory -> dce:explode(delimiter:',')}" as="items" iteration="iterator">{items} </f:for>

BTW: really items? it is only one item (at a time)

Upvotes: 0

Related Questions