1

I have a comment section with comments and subcomments. A comment relates directly to the blog post while a subcomment relates to a comment.

Now, I have the following problem on the entry page: Showing the comments only is not a problem:

{% for comment in craft.entries({
    section: comments,
    relatedTo: { targetElement: entry, field: "relentry" },
    order:     "sortOrder",
    limit:     null
}) %}
    <p>X</p>
{% endfor %}

But when I insert the subcomments, I get the error message Unexpected "}":

{% for comment in craft.entries({
    section: comments,
    relatedTo: { targetElement: entry, field: "relentry" },
    order:     "sortOrder",
    limit:     null
}) %}
    <p>X</p>
    {% for subcomment in craft.entries({
        section: comments,
        relatedTo: { targetElement: comment, field: "relentry" },
        order:     "sortOrder",
        limit:     null
    }) %}
        <p>Y</p>
    {% endfor % }
{% endfor %}

Thank you very much for your help!

2

It's probably your second-from-last line:

{% endfor % }

should be:

{% endfor %}
1
  • Of course, you're right. Thank you very much!
    – MISC
    Aug 5 '16 at 13:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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