<txp:if_comments_allowed /> container tag, 0 attributes

if_comments_allowed

The if_comments_allowed tag is a conditional tag and always used as an opening and closing pair, like this…

<txp:if_comments_allowed>
...conditional statement...
</txp:if_comments_allowed>

The tag will execute the contained statements if comments are allowed for a given article.

This tag can be used in pages, or in article or comment forms; though it will allow you to use an id attribute in a comment form, the default behavior (no attribute) will ensure consistency in comment/article matching when viewing an individual article.

When used in a page template, it will test the article identified by the attribute for status and act, or not, according to that status. It will not pass the id attribute to the contained statement, such as comments or comments_form, they must be added as attributes to the contained tag.

This tag is mainly used in combination with if_comments_disallowed.

<txp:if_comments_allowed /> 2 examples

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 also giving an indication of the comment status.

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

Other tags used: comments_form, if_comments_disallowed

Display a list of IDs

<txp:if_comments_allowed>
<txp:comments form="lineitem" break="li" wraptag="ul" breakclass="special" />
<txp:else />
<p>Comments closed</p>
</txp:if_comments_allowed>

Form (lineitem) (type: comment)

<txp:comment_id />

Styles could go this way

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

What this does…
Displays a list of id numbers for comments on the current article, if comments are currently allowed.

Other tags used: comments, else, comment_id