简体   繁体   中英

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.

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>

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 item s ? it is only one item (at a time)

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:\\',\\')} '

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM