Textpattern CMS Template Tags

<txp:comments_form /> single tag, 7 attributes

comments_form

The comments_form tag is a single tag which is used to display a comment form. Comments will be attached to present individual article as a default, or to the article set by the “id” attribute.

attributes

isize="25" (integer) 
  • (X)HTML size attribute to be applied to the (X)HTML form input.
msgcols="25" (integer)
  • (X)HTML cols attribute to be applied to (X)HTML form textarea output.
msgrows="5" (integer)
  • (X)HTML rows attribute to be applied to (X)HTML form textarea output.
msgstyle="unset" 
  • CSS inline style attribute to be applied to (X)HTML form textarea output. Recommended that you use CSS via textarea’s class or id attribute instead.
form="comment_form" 
  • Use specified form.
wraptag="unset" 
  • (X)HTML tag (without brackets) to wrap around output.
class="comments_form" 
  • CSS class attribute to be applied to wraptag.

genealogy

Version 4.0.4

  • show_preview removed
<txp:comments_form /> 3 examples

Give visitors 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:if_comments_allowed>
   <txp:comments_form />
<txp:else />
   <p>Comments are turned off for this article.</p>
</txp:if_comments_allowed>

Other tags used: if_comments_allowed, else

Text area changes in preview

Using some conditional tags the size of the comment input text area can be changed in the preview.

<txp:if_comments_preview>
	<txp:comments_preview form="comments" />
	<p style="color:red;">This is just a preview of your comment!</p>
	<txp:comments_form isize="30" msgcols="55" msgrows="5" />
<txp:else />
	<txp:if_comments_allowed>
		<txp:comments_form isize="30" msgcols="55" msgrows="15" />
	</txp:else />
		<p>Comments are turned off for this article.</p>
	</txp:if_comments_allowed>
</txp:if_comments_preview>

Other tags used: comments_preview, if_comments_allowed, if_comments_preview, else

Display conditional comments and form

Tags

<txp:if_comments_allowed>
	<txp:comments form="lineitem" break="li" wraptag="ul" breakclass="special" />
	<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 current article, returns a list of id numbers for comments and a comment input form, but only if comments are currently allowed.

Other tags used: comment_id, comments, if_comments_allowed