txp:comments_form

The comments_form tag is a Single Tag. Textpattern will replace this tag with a comment form. Comments will be attached to present individual article as a default, or to the article set by the “id” attribute.

Syntax

The comments_form tag has the following syntactic structure…

<txp:comments_form />

Attributes

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

id="integer"

The ID# assigned to the article you are adding comments to. Default is current article ID#.

isize="integer"

(X)HTML size attribute to be applied to (X)HTML form input output. Default is 25.

msgcols="integer"

(X)HTML cols attribute to be applied to (X)HTML form textarea output. Default is 25.

msgrows="integer"

(X)HTML rows attribute to be applied to (X)HTML form textarea output. Default is 5.

msgstyle="value"

(X)HTML 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="form name"

Use specified form. Default is comment_form. See Form.

class="CSS class name"

(X)HTML class attribute to be applied to wraptag. Default is comments_form.

wraptag="tag"

(X)HTML tag (without brackets) to wrap around output. Default is unset.

Examples

Giving user's indication of "Comments" status

Comments for articles can be turned off or on at the authors 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>

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>

Column list for displaying id numbers for comments for article id 3, and a comment input form, if comments are currently allowed on article id 3

Tags:

<txp:if_comments_allowed id="3">
	<txp:comments id="3" form="lineitem" break="li" wraptag="ul" breakclass="special" />
 
	<txp:comments_form id="3" />
</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;
}

Other tags used: <comment_id />, <comments />, <if_comments_allowed>

Genealogy

Version 4.0.4

  • show_preview removed
txp/comments_form.txt · Last modified: 2008/02/02 07:08 by hcgtv

Home Page | User Forums | Driven by DokuWiki
Copyright © 2008 xPattern