Drupal 7 - How to loop foreach in multiple value in custom view I'm customizing a view (in views-view--myview.tpl.php) based on a node which has a field with multiple value (field_galerie_image).

I'm trying to list in a foreach loop that particular field, and I am wondering how to write it down.

In the following code, I can access a value with $vue-&gt;_field_data["nid"]["entity"]-&gt;field_galerie_image['und'][0]["filename"]; but I need to loop through it.

$vue-&gt;_field_data["nid"]["entity"]-&gt;field_galerie_image['und'][1]["filename"];
$vue-&gt;_field_data["nid"]["entity"]-&gt;field_galerie_image['und'][2]["filename"];


The code I am using is the following one.

&lt;?php foreach ($view-&gt;result as $id =&gt; $vue): ?&gt;
  &lt;?php if($vue): ?&gt;  
    &lt;?php print $vue-&gt;nid; ?&gt;
    &lt;?php print $vue-&gt;node_title; ?&gt;

    &lt;?php print $vue-&gt;_field_data["nid"]["entity"]-&gt;field_galerie_image['und'][0]["filename"]; ?&gt;
  &lt;?php endif; ?&gt;
&lt;?php endforeach; ?&gt;
I found it out; the correct code is the following one.

&lt;?php foreach ($view-&gt;result as $id =&gt; $vue): ?&gt;
  &lt;?php if($vue): ?&gt;  
    &lt;?php print $vue-&gt;nid; ?&gt;
    &lt;?php print $vue-&gt;node_title; ?&gt;

    &lt;?php foreach ($vue-&gt;_field_data["nid"]["entity"]-&gt;field_galerie_image['und'] as $val): ?&gt;
      &lt;?php print $val['filename']; ?&gt;
    &lt;?php endforeach; ?&gt;
  &lt;?php endif; ?&gt;
&lt;?php endforeach; ?&gt;