Help?

Comments

From Textpattern CMS User Documentation

<txp: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.

Attributes

Tag will accept the following attributes (case-sensitive):

break="text"
HTML tag (without brackets) or string used to separate comments.
Default depends upon preference setting, either li or div.
breakclass="class name"
CSS class attribute to be applied to break (when value supplied is a tag).
Default: unset.
class="class name"
CSS class attribute to be applied to wraptag.
Default: comments.
form="form name"
Default is comments.
limit="integer"
The number of comments to display.
Default: 0 (no limit).
offset="integer"
The number of comments to skip.
Default: 0.
sort="sort value(s)"
How to sort the resulting list.
Values:
discussid (comment ID)
parentid (article ID)
name
email
web
ip (IP address)
posted
message
rand() (random)
Default: posted asc.
wraptag="tag text"
HTML tag (without brackets) to wrap around list.
Default depends upon preference setting, either ol or unset.


Example 1: 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

Example 2: 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

Translations [?]