<p>I think you'll need to remove the <code>first()</code> part. Then your twig will look something like this...</p>

<pre><code>&lt;ul class="footlist"&gt;
    &lt;li class="foottitle"&gt;{{ block.navSection }}&lt;/li&gt;
        {% if block.type == "footerCategory" %}
            {% set pages = block.page %}
            {% if pages|length %}
                {% for page in pages %}
                    &lt;li&gt;{{ page.title }}&lt;/li&gt;
                {% endfor %}
            {% end if %}
        {% endif %}
    &lt;/li&gt; 
&lt;/ul&gt;
</code></pre>

CC BY-SA 3.0
2017-10-20T16:34:55.987Z
Holy smokes that worked! Thanks!
Didnt think i would need that extra if and for, but it works!
kingkelly
CC BY-SA 3.0
2017-10-20T04:12:35.487Z
2017-10-20T04:12:35.487Z
Damon
<p>The elementCriteriaModel is a class/object that handles your search. It's a class that combines multiple methods to fetch entries from your database with an iterable interface on it.</p>

<p>That means: when you receive an entry you get all the queries you need attached to it to pull all the relationship instead of loading all the other entries all the time. So entry.matrix is nothing but database command to pull the other entries which makes craft fast. Otherwise you would take much more time.</p>

<p>To make it short: when you loop through your elementCriteriaModel the method <code>.find()</code> is executed, that fetches all your entries and return them as an array. The method first() returns only the first element, last() returns only the last element.</p>

<p>In order to pull all you just need to loop block.page
<code>{% for entry in block.page %}</code> will to it </p>

CC BY-SA 3.0
2017-10-20T04:04:59.157Z
2017-10-20T04:04:59.157Z
Robin Schambach
<p>I have an Entry field (page) as part of my Matrix field (footer).</p>

<p>When the client selects 5 entries, I want to display them all in my list and not just the first. I can only seem to get my code working with .first or .last. Everything else I try gives me the old "Object of class Craft\ElementCriteriaModel could not be converted to string" error.</p>

<pre><code>&lt;ul class="footlist"&gt;
    &lt;li class="foottitle"&gt;{{ block.navSection }}&lt;/li&gt;
        {% if block.type == "footerCategory" %}
        {% set page = block.page.first() %}
           &lt;li&gt;{{ page.title }}&lt;/li&gt;
        {% endif %} 
&lt;/ul&gt;
</code></pre>

<p>My matrix for this list:
<a href="https://i.sstatic.net/fI1Tm.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/fI1Tm.png" alt="enter image description here"></a></p>

CC BY-SA 3.0
2017-10-20T03:53:16.960Z
What happens if you remove the `first()`?
Damon
CC BY-SA 3.0
2017-10-20T16:35:12.697Z
I get the error when i remove first
kingkelly
CC BY-SA 4.0
2023-01-18T15:59:43.490Z
I'm having a similar problem and any help would be greatful. I have this code: {% for entry in craft.entries.section('positions') %} <li class="list-item-career tooltip"> <div class="list-item__title" style="padding: 15px 0px;"> <div class="col-6">{{ entry.title }}</div> <div class="col-6">{{ entry.locationLink.first }}</div> </div>
And this pulls my first entry just fine,. but i now need to list them all but when I change .first to .find() I get error. Can you please let me know what I might be doing wrong?
Joe
<matrix><entries-field>
Show all entries from an entry field
# Show all entries from an entry field

(Asked by: username_0 on 2017-10-20)

I have an Entry field (page) as part of my Matrix field (footer).
When the client selects 5 entries, I want to display them all in my list and not just the first. I can only seem to get my code working with .first or .last. Everything else I try gives me the old "Object of class Craft\ElementCriteriaModel could not be converted to string" error.

    {{ block.navSection }}
        {% if block.type == "footerCategory" %}
        {% set page = block.page.first() %}
           {{ page.title }}
        {% endif %} 


My matrix for this list:

**Tags:** matrix, entries-field

> **Comments:**
> **username_1**: What happens if you remove the `first()`?  
> **username_0**: I get the error when i remove first  
> **username_2**: I'm having a similar problem and any help would be greatful. I have this code: {% for entry in craft.entries.section('positions') %} <li class="list-item-career tooltip"> <div class="list-item__title" style="padding: 15px 0px;"> <div class="col-6">{{ entry.title }}</div> <div class="col-6">{{ entry.locationLink.first }}</div> </div> And this pulls my first entry just fine,. but i now need to list them all but when I change .first to .find() I get error. Can you please let me know what I might be doing wrong?  

---

## 2 answers

### Answer by username_1 on 2017-10-20. Score: 1 | Accepted answer

I think you'll need to remove the first() part. Then your twig will look something like this...

    {{ block.navSection }}
        {% if block.type == "footerCategory" %}
            {% set pages = block.page %}
            {% if pages|length %}
                {% for page in pages %}
                    {{ page.title }}
                {% endfor %}
            {% end if %}
        {% endif %}

> **Comments:**
> **username_0**: Holy smokes that worked! Thanks! Didnt think i would need that extra if and for, but it works!  

---

### Answer by username_3 on 2017-10-20. Score: 1

The elementCriteriaModel is a class/object that handles your search. It's a class that combines multiple methods to fetch entries from your database with an iterable interface on it.

That means: when you receive an entry you get all the queries you need attached to it to pull all the relationship instead of loading all the other entries all the time. So entry.matrix is nothing but database command to pull the other entries which makes craft fast. Otherwise you would take much more time.

To make it short: when you loop through your elementCriteriaModel the method `.find()` is executed, that fetches all your entries and return them as an array. The method first() returns only the first element, last() returns only the last element.

In order to pull all you just need to loop block.page
`{% for entry in block.page %}` will to it


---

