Craft CMS Stack Exchange is a question and answer site for administrators, end users, developers and designers for Craft CMS. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to limit the rows returned here to 4, then if loop.index is 3 display a separator and then output the last row.

Does the table field have that kind of control?

{% for row in registration.registrationCost %}
    <li class="circle">
        <h3 class="registration-cost">{{ row.cost }}</h3>
        <h4>{{ }}</h4>
{% endfor %}
share|improve this question
up vote 6 down vote accepted

According to the Craft docs , the table field returns an array of rows.

Assuming that is the case, you should be able to use the Twig slice filter:

{% for row in registration.registrationCost | slice(0, 3) %}

You can then use a simple conditional to output the row divider:

{% if loop.index == 3 %}  
{% endif %}


share|improve this answer
Thank you Stephen. Steve Abraham just suggested the same thing. I was incorrectly using .limit() before. – Steven Grant Jul 30 '14 at 12:38
STEVE ALL THE THINGS! – Stephen Lewis Jul 30 '14 at 12:43
tis a fine name -- even with your funny spelling :) – Steven Grant Jul 30 '14 at 12:45
Had to comment, just to complete the set. – Steve Abraham Jul 30 '14 at 15:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.