The comments loop is used to display the comments made in response to a blog entry.

The basic syntax of the loop is:

{{loop comments}}
(body of loop goes here)
{{/loop}}

The loop does one iteration for each comment made in response to the blog entry.

The comments loop can also be tested like a boolean variable. It is true if there is at least one comment for the article.



Variables
Within the comments loop, you can use these variables, whose contents change with each iteration:

·author
A string variable containing the name of the author of the current comment.

It can also be used as a boolean variable; it is true if it contains a value.

If the author of the comment made the comment when logged in, author contains a value:

·If the author provided a nickname in the personal settings for his/her account, author contains that nickname.
·If the author did not provide a nickname in the personal settings for his/her account, author contains the author's username.

If the author of the comment made the comment while not logged in or checked the Post anonymously checkbox, author is empty.

·author_url
A string variable containing the URL of the author of the current comment.

It can also be used as a boolean variable; it is true if it contains a value.

If the author provided an URL in the personal settings for his/her account, author_url contains that URL. If the author did not provide an URL, author_url is empty.

·body
A string variable containing the body of the comment, which the author enters into the Comment text area of the comment form.

·can_post
A boolean variable that is true if the reader is allowed to post a comment in reply to this article.

If the publisher of the blog checks the Allow anonymous reader comments checkbox (located in the Options sidebar of the General Settings page in the Settings section), can_post is true for both logged-in and non-logged-in readers. If the publisher does not check this checkbox, can_post is true for logged-in readers and false for non-logged-in readers.

·depth
An integer variable representing the "depth" of the comment.

A depth of 0 means that the comment is a direct reply to the entry. A depth of 1 means that the comment is a reply to a comment that is a direct reply to the entry. A depth of 2 means that the comment is a reply to a comment which in turn is a reply to comment that is a direct reply to the entry.

·marker
A string variable containing the URL for the comment.

This URL is used as the "permanent link" for the comment, allowing it to be referenced with a link.

·post_reply_url
A string variable containing the URL to the "comment page" for this article.

·publish_time
The publish time for this article.

·publish_time.24hour
The hour the comment was posted in 24-hour time.

·publish_time.ampm
AM or PM for 12-hour time.

·publish_time.day
The day the comment was posted.

·publish_time.day_name
The day of the week.

·publish_time.day_name_short
The abbreviated day of the week.

·publish_time.hour
The hour the comment was posted in 12-hour time.

·publish_time.min
The minute the comment was posted.

·publish_time.month
The month the comment was posted.

·publish_time.month_name
The name of the month.

·publish_time.month_name_short
The abbreviated name of the month.

·publish_time.sec
The second the comment was posted.

·publish_time.year
The year the comment was posted.

·publish_time.zone
The time zone being used to calculate times.

·title
A string variable containing the title of the comment, which the author enters into the Subject text box of the comment form.



Example
<div class="comments">

{{if comments}}
{{loop comments}}
<a name="{{marker}}"></a>
<div class="comment">
<div class="commentIndent{{depth}}">
<div class="commentTitle">{{title}}</div>
<div class="commentAuthor">by
{{if author}}
{{if author_url}}
<a href="{{author_url}}">{{author}}</a>
{{else}}
{{author}}
{{/if}}
{{else}}
Anonymous
{{/if}}
at {{publish_time.hour}}:{{publish_time.min}}{{publish_time.ampm}} ({{publish_time.zone}}) on {{publish_time.month_name_short}} {{publish_time.day}}, {{publish_time.year}} &nbsp;|&nbsp; <a href="#{{marker}}">Permanent Link</a></div>
<div class="commentBody">{{body}}</div>
{{if allow_comments}}
<div class="commentReply"><a href="{{post_reply_url}}">Reply</a></div>
{{/if}}
</div> <!-- commentIndentn -->
</div> <!-- comment -->
{{/loop}}

{{else}}
No comments found.
{{/if}} <!-- comments -->

</div> <!-- comments -->