<pre><code>{% for block in contactDetails.myMatrixField %}
     {{ block.location }}
     {{ block.address }}
{% endfor %}
</code></pre>

CC BY-SA 3.0
2014-07-08T14:51:04.183Z
The handle for my global and my matrix field were stupidly the same. Thanks Jpea!
simonsweeney
CC BY-SA 3.0
2014-07-08T14:48:52.257Z
2014-07-08T14:48:52.257Z
jpea
<p>This might be a very simple question but I am pretty new to Craft with a EE background. Basically, I have a global containing contact details that use a matrix field, I’m literally just looking for the syntax to loop through the matrix blocks.</p>

<p>I have tried similar code to the successful matrix fields I have in other areas, but how do I reference the particular global? This is what I’ve attempted with no success:</p>

<pre><code>{% for block in contactDetails %}
    {{ block.location }}
    {{ block.address }}
{% endfor %}
</code></pre>

<p><code>contactDetails</code> being the name of the global. I’m sure this is very simple I just can’t figure it out.</p>

<matrix>
Looping through a Global with a Matrix field
# Looping through a Global with a Matrix field

(Asked by: username_0 on 2014-07-08)

This might be a very simple question but I am pretty new to Craft with a EE background. Basically, I have a global containing contact details that use a matrix field, I’m literally just looking for the syntax to loop through the matrix blocks.
I have tried similar code to the successful matrix fields I have in other areas, but how do I reference the particular global? This is what I’ve attempted with no success:
{% for block in contactDetails %}
    {{ block.location }}
    {{ block.address }}
{% endfor %}

contactDetails being the name of the global. I’m sure this is very simple I just can’t figure it out.

**Tags:** matrix


---

## 1 answers

### Answer by username_1 on 2014-07-08. Score: 6 | Accepted answer

{% for block in contactDetails.myMatrixField %}
     {{ block.location }}
     {{ block.address }}
{% endfor %}

> **Comments:**
> **username_0**: The handle for my global and my matrix field were stupidly the same. Thanks Jpea!  

---

