[Resolu] How concat string of foreach loop

[Resolu] How concat string of foreach loop

Friday 15 September 2006 6:25:27 am - 4 replies

Modified on Monday 18 September 2006 2:23:56 am by Stéphane Bullier

Author Message

Claudia Kosny

Friday 15 September 2006 9:46:37 am

Hello Stephane

Just use the append operator

http://ez.no/doc/ez_publish/technical_manual/3_8/reference/template_operators/strings/append

Greetings from Luxembourg

Claudia

Kristian Hole

Friday 15 September 2006 9:46:47 am

Hello Stéphane,

Did you try something like

{def $string=''} 
 {foreach $node.data_map.morceaux.value.columns.sequential.1.rows as $index => $object} 
        {set $string=concat($string, $object)}
 {/foreach}

Result: {$string}

Kristian

http://ez.no/ez_publish/documenta...tricks/show_which_templates_are_used
http://ez.no/doc/ez_publish/techn...te_operators/miscellaneous/attribute

Kristian Hole

Friday 15 September 2006 11:20:17 am

Or even simpler:

{def $result=$node.data_map.morceaux.value.columns.sequential.1.rows|implode(" ")} 

result:{$result}

Kristian

http://ez.no/ez_publish/documenta...tricks/show_which_templates_are_used
http://ez.no/doc/ez_publish/techn...te_operators/miscellaneous/attribute

Stéphane Bullier

Monday 18 September 2006 12:30:18 am

Hello Claudia and Kristian,

Thank very much yours replies. It's working nice.

Cheers

Stéphane

You must be logged in to post messages in this topic!

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.