<txp:comments /> single tag, 8 attributes

comments

The comments tag is a single tag which is used to display the comments associated with a particular article. Comments will be displayed for the present individual article as a default, or to the article set by the “id” attribute.

Related: if_comments, if_comments_allowed, if_comments_disallowed

attributes

sort="posted asc" 
  • Values
    • discussid (comment ID)
    • parentid (article ID)
    • name
    • email
    • web
    • ip (IP address)
    • posted
    • message
    • rand() (random)
  • Direction
    • asc (ascending)
    • desc (descending)
form="comments"
  • The form to use to display each comment.
wraptag="ol or unset" 
  • (X)HTML tag (without brackets) to wrap around list.
  • Default depends upon preference setting: Present comments as a numbered list?
break="li or div" 
  • (X)HTML tag (without brackets) or string used to separate comments.
  • Default depends upon preference setting: Present comments as a numbered list?
class="comments" 
  • CSS class attribute to be applied to wraptag.
breakclass="unset" 
  • CSS class attribute to be applied to break (when value supplied is a tag).
offset="0" (integer)
  • The number of comments to skip.
limit="0" (integer)
  • The number of comments to display.
<txp:comments /> 2 examples

Display comments, and give an indication of Comments status

Comments for articles can be turned off or on at the author’s discretion for any article that is published; by using the following scheme in an article form, you can still have the on/off control over comments while still giving users indication of comment status.

<txp:comments />
<txp:if_comments_allowed>
	<txp:comments_form />
<txp:else />
	<p>Comments are turned off for this article.</p>
</txp:if_comments_allowed>

Other tags used: comments_form, if_comments_allowed, else

Conditional comments

Tags

<txp:if_comments_allowed>
	<txp:comments form="lineitem" breakclass="special" break="li" wraptag="ul" />
	<txp:comments_form />
</txp:if_comments_allowed>

Form (lineitem) (type: comment)

<small><txp:comment_id /></small>

Styles could go this way

.special
{
        display:list-item;
        list-style-type:none;
}

What it does…
For the article, list id numbers and a comment input form; but only if comments are currently allowed.

Other tags used: comment_id, comments_form, if_comments_allowed