<p>I would write something like this:</p>

<pre><code>{% set ids = craft.request.param('ids')| split('|') %}
{% for id in ids %}
    {% set entry = craft.entries.id(id).first() %}
    …
{% endfor %}
</code></pre>

<p>Alternatively, to reduce the queries, store all the entries in a variable and then loop through ids and find the right match in this smaller set.</p>

CC BY-SA 3.0
2017-09-27T15:34:47.080Z
Don't you need to add `.first` to `craft.entries` since it returns an object?
Ryan
CC BY-SA 3.0
2017-09-27T15:40:54.077Z
Yes, right, edited.
Alessio Breviglieri
CC BY-SA 3.0
2017-09-27T15:59:53.550Z
You need a dot before `first()`!
Ryan
CC BY-SA 3.0
2017-09-27T21:28:15.297Z
Hi, this worked like a charm. And yes, please add the the dot before `first()`. Thanks a lot!
outline4
CC BY-SA 3.0
2017-09-27T15:04:27.643Z
2017-09-28T06:31:39.097Z
2017-09-28T06:31:39.097Z
Alessio Breviglieri
<p>I've set up a print template for furniture labels.<br>
I let my client print the labels with a special Link like </p>

<pre><code>/label?ids="x|y|z"
</code></pre>

<p>It all works good. Now he sometimes wants to print the same label multiple times, so he and I tried the following: </p>

<pre><code>/label?ids="x|x|x|y|z|z|z"
</code></pre>

<p>The underlying code is the following: </p>

<pre><code>{% set ids = craft.request.param('ids')| split('|')|join(',') %}
{% set params =
    {
        section: 'furniture',
        limit : null,
        id: ids

    }
%}
{% paginate craft.entries(params) as entries %}
{% for entry in entries %}
     ...
{% endfor %}
</code></pre>

<p>This will only display x and z one time.   </p>

<p>Is there a way around this? </p>

<p>Any help appreciated. </p>

<entries>
How to display an entry id multiple times?
# How to display an entry id multiple times?

(Asked by: username_0 on 2017-09-27)

I've set up a print template for furniture labels.
I let my client print the labels with a special Link like 
/label?ids="x|y|z"

It all works good. Now he sometimes wants to print the same label multiple times, so he and I tried the following: 
/label?ids="x|x|x|y|z|z|z"

The underlying code is the following: 
{% set ids = craft.request.param('ids')| split('|')|join(',') %}
{% set params =
    {
        section: 'furniture',
        limit : null,
        id: ids

    }
%}
{% paginate craft.entries(params) as entries %}
{% for entry in entries %}
     ...
{% endfor %}

This will only display x and z one time.   
Is there a way around this? 
Any help appreciated.

**Tags:** entries


---

## 1 answers

### Answer by username_1 on 2017-09-27. Score: 3 | Accepted answer

I would write something like this:
{% set ids = craft.request.param('ids')| split('|') %}
{% for id in ids %}
    {% set entry = craft.entries.id(id).first() %}
    …
{% endfor %}

Alternatively, to reduce the queries, store all the entries in a variable and then loop through ids and find the right match in this smaller set.

> **Comments:**
> **username_2**: Don't you need to add `.first` to `craft.entries` since it returns an object?  
> **username_1**: Yes, right, edited.  
> **username_2**: You need a dot before `first()`!  
> **username_0**: Hi, this worked like a charm. And yes, please add the the dot before `first()`. Thanks a lot!  

---

