Buy Now
Sign in

Display multiple records CCv5

Pigna , October 04 at 16:49
P
Pigna

Hi Bob & Max and everybody,

I have a connection with two tables: one is the main, the second is related with an hasMany relation because two ore more records are connected by a foreign key with an element of the first table.

The connection is ok.

But i have problem to display multiple records. In the "Front list->Settings (display type Table)" i have some columns with their value from the main table (they are ok). Then I create a column for display datas from the second table and in every row I would display one or more value but I can't.

I read many topic so I try many code but nothing works for me:

if in HTML box I try

				Model.field:{Model.[n].field}
				


the result is: "array (0 => 'element1', 1=> 'element2'...)" instead of "elment1, element2, ..." (that is what I really want).

if in PHP functions box i put

				Model.field: return $row ['Model'][0]['field']
				


the result is only the last element, so I've try a foreach loop:

				Model.field: foreach ($row['Model'] as $k => $v) {return $v['field'];}
				


but the result is the same: only the last element.


Another info: if in the "Fron list->Actions->view" i put a classic php foreach loop like

				<?php foreach ($row['Model'] as $k => $v) {echo $v['field'];}?>
				


i see every fields (without comma :? ).


Can you guys give me a hand (and forgive me for my english)?