<p>Bratvold, what do you mean with "input"? </p>

<p>Actually, if you can get the title of your prev-item, you can get everything of it. </p>

<pre><code>{% if prevEntry %}
  &lt;a class="project" data-type="image" href="{{ prevEntry.url }}"&gt;
    &lt;img
      src="{{ prevEntry.portfolioImage.one().getUrl('progressivePortfolio') }}"
      data-src="{{ prevEntry.portfolioImage.one().getUrl() }}"
    &gt;
    &lt;h3&gt;{{ prevEntry.title }}&lt;/h3&gt;
    &lt;div class="project-client pink bold"&gt;
      {% for row in prevEntry.kunde.all() %}
          {{ row.kundenavn }}
      {% endfor %}
    &lt;/div&gt;
  &lt;/a&gt;
{% endif %}
</code></pre>

CC BY-SA 4.0
2020-05-26T18:42:11.860Z
Thanks for the reply! prevEntry worked great for the images but not the other part. This part comes up empty:
```{% for row in prevEntry.kunde.all() %}
    {{ row.kundenavn }}
{% endfor %}
```
Stig Melón-Bratvold
CC BY-SA 4.0
2020-05-26T19:53:34.133Z
What type of field is ``kunde``? Matrix? Table?
RitterKnight
CC BY-SA 4.0
2020-05-27T08:44:22.423Z
If "kundenavn" is an entries selection field, you need to loop again. 

`{% for entry in row.kundenavn %}{{ entry.title }}{% endfor %}`
Marten Brosch
CC BY-SA 4.0
2020-05-29T19:32:17.020Z
Thanks @MartenBrosch :)
Stig Melón-Bratvold
CC BY-SA 4.0
2020-05-26T15:09:34.673Z
2020-05-26T15:09:34.673Z
Marten Brosch
<p>To expand upon <a href="https://craftcms.stackexchange.com/questions/27269/how-to-get-the-previous-or-next-two-entries?answertab=active#tab-top">How to get the previous or next two entries</a> I was wondering how I can also add the image and an input from each entry.</p>

<p>I have simplified the html-structure in this example but essentially what I want to add is:
entry.portfolioImage.one and row.kundenavn from row in entry.kunde.</p>

<p>The links and entry title is working.</p>

<pre><code>{# Set parameters for prev/next elements list #}
{% set params = craft.entries.section('portfolio').order('title desc') %}

{# Get the prev/next elements #}
{% set prevEntry = entry.getPrev(params) %}
{% set nextEntry = entry.getNext(params) %}

{# And make sure to only output the links if the element exists #}
{% if prevEntry %}
  &lt;a class="project" data-type="image" href="{{ prevEntry.url }}"&gt;
    &lt;img
      src="{{ entry.portfolioImage.one().getUrl('progressivePortfolio') }}"
      data-src="{{ entry.portfolioImage.one().getUrl() }}"
    &gt;
    &lt;h3&gt;{{ prevEntry.title }}&lt;/h3&gt;
    &lt;div class="project-client pink bold"&gt;
      {% for row in entry.kunde %}
          {{ row.kundenavn }}
      {% endfor %}
    &lt;/div&gt;
  &lt;/a&gt;
{% endif %}
{% if nextEntry %}
  &lt;a class="project" data-type="image" href="{{ nextEntry.url }}"&gt;
    &lt;img
      src="{{ entry.portfolioImage.one().getUrl('progressivePortfolio') }}"
      data-src="{{ entry.portfolioImage.one().getUrl() }}"
    &gt;
    &lt;h3&gt;{{ nextEntry.title }}&lt;/h3&gt;
    &lt;div class="project-client pink bold"&gt;
      {% for row in entry.kunde %}
          {{ row.kundenavn }}
      {% endfor %}
    &lt;/div&gt;
  &lt;/a&gt;
{% endif %}
</code></pre>

<templating><craft3>
How to get the previous or next two entries with images and
# How to get the previous or next two entries with images and

(Asked by: username_0 on 2020-05-25)

To expand upon How to get the previous or next two entries I was wondering how I can also add the image and an input from each entry.
I have simplified the html-structure in this example but essentially what I want to add is:
entry.portfolioImage.one and row.kundenavn from row in entry.kunde.
The links and entry title is working.
{# Set parameters for prev/next elements list #}
{% set params = craft.entries.section('portfolio').order('title desc') %}

{# Get the prev/next elements #}
{% set prevEntry = entry.getPrev(params) %}
{% set nextEntry = entry.getNext(params) %}

{# And make sure to only output the links if the element exists #}
{% if prevEntry %}
  
    
    {{ prevEntry.title }}
    
      {% for row in entry.kunde %}
          {{ row.kundenavn }}
      {% endfor %}
    
  
{% endif %}
{% if nextEntry %}
  
    
    {{ nextEntry.title }}
    
      {% for row in entry.kunde %}
          {{ row.kundenavn }}
      {% endfor %}
    
  
{% endif %}

**Tags:** templating, craft3


---

## 1 answers

### Answer by username_1 on 2020-05-26. Score: 2 | Accepted answer

Bratvold, what do you mean with "input"? 
Actually, if you can get the title of your prev-item, you can get everything of it. 
{% if prevEntry %}
  
    
    {{ prevEntry.title }}
    
      {% for row in prevEntry.kunde.all() %}
          {{ row.kundenavn }}
      {% endfor %}
    
  
{% endif %}

> **Comments:**
> **username_0**: Thanks for the reply! prevEntry worked great for the images but not the other part. This part comes up empty: ```{% for row in prevEntry.kunde.all() %}     {{ row.kundenavn }} {% endfor %} ```  
> **username_2**: What type of field is ``kunde``? Matrix? Table?  
> **username_1**: If "kundenavn" is an entries selection field, you need to loop again.   `{% for entry in row.kundenavn %}{{ entry.title }}{% endfor %}`  
> **username_0**: Thanks @MartenBrosch :)  

---

