String.split in einer html Datei


(Paul Ehrlich) #1

Hallo Forum,

ich möchte einen String splitten, siehe Beispiel:

<f:section name="itemsList">
	<f:for each="{items}" as="item">
		<f:if condition="{item.node.properties.workshopOrt}">
			<p >
				String.split({item.node.properties.workshopOrt},',')[0]
			</p>
		</f:if>
	</f:for>
</f:section>

Wie kann ich das erreichen?

Vielen Dank,
Paul


(Daniel Lienert) #2

Hey Paul,

the split line almost looks like fusion, you can do that using fusion:

Fusion:

splittedString = ${String.split(node.properties.workshopOrt, ',')[0]}

HTML / Fluid:

<p>{splittedString}</p>

Cheers, Daniel


(Paul Ehrlich) #3

Moin Daniel,

thanks for your answer!
In my html-file, I’m in an iteration loop (listitems) at that position and I thought that there is an alternative method for the split-method in fusion…
otherwise I have to put the loop into the fusion-file and take only the results into the html-file.
But how do I start with that?

Skòl, Paul