<tpl:Comments>

The tag tpl:comments displays a list of comments in two different contexts:

  • Inside a post (in a tpl:Entries loop for example), the comments fetched will be the comments for this post.
  • Outside a post, all comments will be fetched, from all posts, depending in the page context.

Comments thus fetched will systematically be sorted by date.

Attributes

lastn

This attribute allows to limit the number of comments displayed. If not value is given or if the value is set to *0*, all comments will be displayed.

Exception : this tag is also used in the context of RSS/Atom feed generation. In this case and only this case, the number of comments fetched will be limited to the maximum number per feed specified in the blog configuration.

with_pings

This attribute, when set to 1, allows to fetch both comments and trackbacks in the list of comments displayed.

order

This attribute indicates in which order the comments will be displayed:

  • asc indicates that comments will be returned from the oldest to the newest
  • desc indicates that comments will be returned from the newest to the oldest

The default value is desc

no_context

The tpl:Comments loop takes into account various filters imposed by the context. For example, if you integrate this loop in a tpl:Categories loop, the filtering by category will be automatically applied. The context elements taken into account are:

  • The current category
  • The current language

This attribute, when set to 1, allows to bypass the existing filters.

no_content

When this attribute is set to 1, the actual content of comments will not be available. This can be useful to build lists that only contain authors or dates of comments.

Examples

The 15 last comments, from the newest to the oldest

<tpl:Comments lastn="15" order="desc">

The last three comments for each of the blog's categories

<tpl:Categories>
  <h2>{{tpl:CategoryTitle}}</h2>
  <tpl:Comments lastn="3">
    <p>{{tpl:CommentContent}}</p>
  </tpl:Comments>
</tpl:Categories>

Wiki powered by Dokuwiki.