Go to main content

If comments

Contents

Syntax

<txp:if_comments>

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

<txp:if_comments>
    …conditional statement…
</txp:if_comments>

The tag will execute the contained statements if there are one or more comments associated with a particular article. Should be used in an ‘article’ type form.

Attributes

This tag has no attributes of its own. It accepts only the global attributes .

Examples

Example 1: Number of comments associated with an article

<txp:if_comments>
    <p>
        Comments:
        <txp:comments_count />
    <p>
<txp:else />
    <p>No comments.</p>
</txp:if_comments>

Displays the number of comments written against the current article, otherwise display text to indicate there are no comments.

Other tags used: comments_count, else.

If you notice any kind of problem with this page's construction or content (outdated information, typos, broken links, or whatever), open an issue to have it sorted. Or have a go at it yourself. :)