<p>This is because you're using an html list <code>&lt;li&gt;</code> element, which by default puts each element on a new line.  You could style away the newline I suppose, but why use it at all...there are a bunch of ways of doing this, but this is one simple one:</p>

<pre><code>{% set developers = entry.GamesDeveloper %}
{% if developers|length %}
Developer: 
{% for developer in developers %}           
    &lt;a href="{{ developer.url }}"&gt;{{ developer.title }}&lt;/a&gt;{% if not loop.last %}, {% endif %}
{% endfor %}
{% endif %}
</code></pre>

CC BY-SA 3.0
2016-12-21T00:32:37.797Z
I need to be able to keep it within a html list though. I have data before and after that will also b in a list. aka
DevServe
CC BY-SA 3.0
2016-12-21T00:34:13.910Z
Ok well then you need to style the list I guess - something like `li { display: inline; }` in your css should do it.
Jeremy Daalder
CC BY-SA 3.0
2016-12-21T00:35:22.540Z
...but you'll still need to put `Developer:` outside your for loop of course.  And if you want the commas check the `not loop.last` condition....
Jeremy Daalder
CC BY-SA 3.0
2016-12-21T00:26:28.437Z
2016-12-21T00:26:28.437Z
Jeremy Daalder
<p>I have a FOR loop that should be displaying all the entry titles on one line. But instead, it is outputting them on separate lines. </p>

<p>I want to see:</p>

<pre><code>Developer: Jane Doe, Jim Doe
</code></pre>

<p>Instead, I am getting:</p>

<pre><code>Developer: Jane Doe
Developer: Jim Doe
</code></pre>

<p>My code:</p>

<pre><code>{% set developers = entry.GamesDeveloper %}

{% for developer in developers %}
    &lt;li&gt;Developer: &lt;a href="{{ developer.url }}"&gt;{{ developer.title }}&lt;/a&gt;&lt;/li&gt;
{% endfor %}
</code></pre>

<entries><forloop><loop>
Display all entry titles on one line during FOR loop
# Display all entry titles on one line during FOR loop

(Asked by: username_0 on 2016-12-20)

I have a FOR loop that should be displaying all the entry titles on one line. But instead, it is outputting them on separate lines. 
I want to see:
Developer: Jane Doe, Jim Doe

Instead, I am getting:
Developer: Jane Doe
Developer: Jim Doe

My code:
{% set developers = entry.GamesDeveloper %}

{% for developer in developers %}
    Developer: {{ developer.title }}
{% endfor %}

**Tags:** entries, forloop, loop

---

## 1 answers

### Answer by username_1 on 2016-12-21. Score: 4 | Accepted answer

This is because you're using an html list  element, which by default puts each element on a new line.  You could style away the newline I suppose, but why use it at all...there are a bunch of ways of doing this, but this is one simple one:
{% set developers = entry.GamesDeveloper %}
{% if developers|length %}
Developer: 
{% for developer in developers %}           
    {{ developer.title }}{% if not loop.last %}, {% endif %}
{% endfor %}
{% endif %}

> **Comments:**
> **username_0**: I need to be able to keep it within a html list though. I have data before and after that will also b in a list. aka  
> **username_1**: Ok well then you need to style the list I guess - something like `li { display: inline; }` in your css should do it.  
> **username_1**: ...but you'll still need to put `Developer:` outside your for loop of course.  And if you want the commas check the `not loop.last` condition....  

---

