Listing Comments
The decorator described in Article Commenting provides easy access to any comment
made in relation to a given content type: you simply retrieve a list
of comments using article.relatedElements
.
To retrieve the number of comments made on an article:
${article.relatedElements.forum.commentCount}
To retrieve the actual comments:
<c:forEach var="comment" items="${article.relatedElements.forum.comments}"> <p>${comment.title}</p> </c:forEach>
If threaded comments (that is, comments with replies) are being used, then retrieving the next level of comments is simply a matter of iterating over the current comment's replies:
<c:forEach var="comment" items="${article.relatedElements.forum.comments}"> <p>${comment.title}</p> ... <p>Replies:<p> <c:forEach var="reply" items="${comment.replies}"> <p>${comment.title}</p> </c:forEach> ... </c:forEach>