<p>This is how you're getting your <em>"Forside" articles</em>:</p>

<pre><code>{% for entry in entry.artikkelbolk1.limit(14) %}
    &lt;!--print out article content--&gt;
{% endfor %}
</code></pre>

<p>this let me assume you're using an entries field to "collect" articles from your "artikkelbolk1" section.
The Twig syntax you're using is actually a shortcut for this:</p>

<pre><code>{% for entry in craft.entries({
    relatedTo: { sourceElement: entry, field: 'artikkelbolk1' },
    order:     'sortOrder',
    limit:     14
}) %}
    &lt;!--print out article content--&gt;
{% endfor %}
</code></pre>

<p>So it get's you all entries related to your current <code>entry</code>, the preset entry model of your "forside" section.</p>

<p>To get <em>all articles not listed on "Forside"</em> you'd do this. First, grab those "forside" entries again, but you're only interested in the IDs
of the entry models, that's why you now append the <code>ids()</code> method. Then join the IDs into a string with the following syntax (use Twig's <code>join</code> filter for that!):</p>

<pre><code>'and, not 42, not 82, not 20'
</code></pre>

<p>So it basically lists all entry IDs prefixed with <code>'not'</code>; the <code>'and'</code> at the beginning just makes Craft aware that you're listing multiple values. With this string you can now go ahead and exclude your entries from an ElementCriteriaModel. To do that simply pass the string into the <code>id</code> parameter.</p>

<pre><code>{% set forside = craft.entries.section('forside').first() %}

{% set forsideEntriesIds = craft.entries({
    relatedTo: { sourceElement: forside, field: 'artikkelbolk1' },
    order:     'dateCreated desc',
    limit:     14
}).ids() %}

{% set idParam = 'and, not ' ~ forsideEntriesIds|join(', not ') %}

{% for entry in craft.entries.section('artikkel').id(idParam).order('dateCreated desc') %}
    &lt;!--print out article content--&gt;
{% endfor %}
</code></pre>

CC BY-SA 3.0
2015-04-27T08:38:14.300Z
Hey, thanks so much for the answer. Unfortunately it doesn't work and I'm going crazy. I'll try to explain one more time. I'm printing out my articles in index.html like this:

{% for entry in entry.artikkelbolk1.limit(6).offset(1) %}
      {# content #}
{% endfor %}

{% for entry in entry.artikkelbolk2.limit(6).offset(1) %}
      {# content #}
{% endfor %}

Now I'm listing all the articles in loadmore.html: 

{% for entry in craft.entries.section('artikkel').order('dateCreated desc') %}
      {# content #}
{% endfor %}

I just can't find a way to print out all the ones that's not been listed
steve1938
CC BY-SA 3.0
2015-04-27T08:45:34.050Z
This works in my code when replacing the existing code:
{% for entry in craft.entries({
    relatedTo: { sourceElement: entry, field: 'artikkelbolk1' },
    order:     'sortOrder',
    limit:     14
}) %}

, but you lost me on grabbing the id's and the code under does not work :(
steve1938
CC BY-SA 3.0
2015-04-27T08:51:01.997Z
It might be that the code would work if i just had one 'artikkelbolk', but I have 'artikkelbolk1' and 'artikkelbolk2' with both have seven articles in them that makes 14 articles. the code would be something like this?:

{% set forside = craft.entries.section('forside').first() %}

{% set forsideEntriesIds = craft.entries({
    relatedTo: { sourceElement: forside, field: 'artikkelbolk1, artikkelbolk2' },
    order:     'dateCreated desc',
    limit:     14
}).ids() %}

{% set idParam = 'and, not ' ~ forsideEntriesIds|join(', not') %}
steve1938
CC BY-SA 3.0
2015-04-24T11:10:50.553Z
2018-04-30T11:43:18.333Z
2018-04-30T11:43:18.333Z
carlcs
<p>I have a bunch of entries in a section called 'artikkel'. The 14 first of these entries are listed out in another section called 'forside'. Now I need to list out the entries that's not already been shown. Printing out the first 14 entries looks like this: </p>

<pre><code>{% for entry in entry.artikkelbolk1.limit(14) %}
    &lt;div class="older_articles"&gt;
        &lt;!--print out article content--&gt;
    &lt;/div&gt;
{% endfor %}
</code></pre>

<p>The rest of the articles that I'm loading in with ajax is like this:</p>

<pre><code>{% for entry in craft.entries.section('artikkel').order('dateCreated desc') %}
    &lt;div class="older_articles ajax_article"&gt;
        &lt;!--print out article content--&gt;
    &lt;/div&gt;
{% endfor %}
</code></pre>

<p>Of course the last one now prints all the articles that's already been printed before. PS: This is the first time I'm working with Craft.</p>

<templating><entries><elementcriteriamodel>
Get entries that's not already listed
# Get entries that's not already listed

(Asked by: username_0 on 2015-04-24)

I have a bunch of entries in a section called 'artikkel'. The 14 first of these entries are listed out in another section called 'forside'. Now I need to list out the entries that's not already been shown. Printing out the first 14 entries looks like this: 
{% for entry in entry.artikkelbolk1.limit(14) %}
    
        
    
{% endfor %}

The rest of the articles that I'm loading in with ajax is like this:
{% for entry in craft.entries.section('artikkel').order('dateCreated desc') %}
    
        
    
{% endfor %}

Of course the last one now prints all the articles that's already been printed before. PS: This is the first time I'm working with Craft.

**Tags:** templating, entries, elementcriteriamodel

---

## 1 answers

### Answer by username_1 on 2015-04-24. Score: 3

This is how you're getting your "Forside" articles:
{% for entry in entry.artikkelbolk1.limit(14) %}
    
{% endfor %}

this let me assume you're using an entries field to "collect" articles from your "artikkelbolk1" section.
The Twig syntax you're using is actually a shortcut for this:
{% for entry in craft.entries({
    relatedTo: { sourceElement: entry, field: 'artikkelbolk1' },
    order:     'sortOrder',
    limit:     14
}) %}
    
{% endfor %}

So it get's you all entries related to your current entry, the preset entry model of your "forside" section.
To get all articles not listed on "Forside" you'd do this. First, grab those "forside" entries again, but you're only interested in the IDs
of the entry models, that's why you now append the ids() method. Then join the IDs into a string with the following syntax (use Twig's join filter for that!):
'and, not 42, not 82, not 20'

So it basically lists all entry IDs prefixed with 'not'; the 'and' at the beginning just makes Craft aware that you're listing multiple values. With this string you can now go ahead and exclude your entries from an ElementCriteriaModel. To do that simply pass the string into the id parameter.
{% set forside = craft.entries.section('forside').first() %}

{% set forsideEntriesIds = craft.entries({
    relatedTo: { sourceElement: forside, field: 'artikkelbolk1' },
    order:     'dateCreated desc',
    limit:     14
}).ids() %}

{% set idParam = 'and, not ' ~ forsideEntriesIds|join(', not ') %}

{% for entry in craft.entries.section('artikkel').id(idParam).order('dateCreated desc') %}
    
{% endfor %}

> **Comments:**
> **username_0**: Hey, thanks so much for the answer. Unfortunately it doesn't work and I'm going crazy. I'll try to explain one more time. I'm printing out my articles in index.html like this:  {% for entry in entry.artikkelbolk1.limit(6).offset(1) %}       {# content #} {% endfor %}  {% for entry in entry.artikkelbolk2.limit(6).offset(1) %}       {# content #} {% endfor %}  Now I'm listing all the articles in loadmore.html:   {% for entry in craft.entries.section('artikkel').order('dateCreated desc') %}       {# content #} {% endfor %}  I just can't find a way to print out all the ones that's not been listed  
> **username_0**: This works in my code when replacing the existing code: {% for entry in craft.entries({     relatedTo: { sourceElement: entry, field: 'artikkelbolk1' },     order:     'sortOrder',     limit:     14 }) %}  , but you lost me on grabbing the id's and the code under does not work :(  
> **username_0**: It might be that the code would work if i just had one 'artikkelbolk', but I have 'artikkelbolk1' and 'artikkelbolk2' with both have seven articles in them that makes 14 articles. the code would be something like this?:  {% set forside = craft.entries.section('forside').first() %}  {% set forsideEntriesIds = craft.entries({     relatedTo: { sourceElement: forside, field: 'artikkelbolk1, artikkelbolk2' },     order:     'dateCreated desc',     limit:     14 }).ids() %}  {% set idParam = 'and, not ' ~ forsideEntriesIds|join(', not') %}  

---

