Textpattern CMS Template Tags

<txp:if_comments_disallowed /> container tag, 0 attributes

if_comments_disallowed

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

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

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

The if_comments_disallowed tag can be used in pages, and in article and comment forms. 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.

Although you can 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.

This tag is mainly used in combination with if_comments_allowed.

<txp:if_comments_disallowed /> 2 examples

Giving an indication of comment 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:if_comments_allowed>
<txp:if_comments_disallowed>
   <p>Comments are turned off for this article.</p>
</txp:if_comments_disallowed>

Other tags used: if_comments_allowed, comments_form

List of comment links

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

Form (lineitem) (type: comment)

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

Styles could go this way

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

What this does…
Displaying a list of links to comments for the current article, using the comment id as text, but only if comments are currently not allowed.

Other tags used: comments, comment_permlink, comment_id