Tuesday 12 April 2011 8:44:29 am
Hi there,
I'm new to eZ Publish, but well versed in PHP. I'm currently working in a template file and struggling somewhat with the syntax / rules, I wonder if someone might be able to help? I have defined an empty array;
{def $names = array()}
at the top of my particular template file. I then have a bunch of stuff outputting in HTML, and finally a foreach loop as follows;
{foreach $some_objects as $index => $rel_objects }
{if eq( $rel_objects.class_identifier, 'speaker' )}
{$names|append( concat( $rel_objects.data_map.first_name.content , ' ' , $rel_objects.data_map.last_name.content ) ) }
{/if}
{/foreach}
{if gt( $names|count() , 0 )}
{$names|implode( ', ' )}
{/if} My problem seems to be that the concatenation is incorrectly done, as I end up echoing $names as "Array Array Array ..." etc... (note, without any seperating commas!?...) Any help would be appreciated here, I have no idea why the $rel_objects.data_map.first_name.content is being echo'd as an array when;
{$rel_objects.data_map.first_name.content} outputs a string (as expected). Thanks!
|