comments_display.txp

Posted

Used to display all the comments features, and calls other comment type forms.

<!-- if there are comments, display them (note: example code below overrides the global preference setting for comments wrapping by stating
     attributes of wraptag="" and break="", you are instead using ol and li tags below)... -->
<txp:if_comments>

    <section id="comments-head">
        <h3>
            <txp:text item="comments" />
        </h3>
        <ol class="comments-list">

            <txp:comments wraptag="" break="li" /> <!-- links by default to form: 'comments.comment.txp' unless you specify a different form -->

            <!-- if this is a comment preview, display it (but only if there is no error) -->
            <txp:if_comments_preview>
                <li>
                    <p id="cpreview">
                        <txp:text item="press_preview_then_submit" />
                    </p>

                    <!-- links by default to form: 'comments.comment.txp' unless you specify a different form -->
                    <txp:comments_preview wraptag="" />

                </li>
            </txp:if_comments_preview>

        </ol>

<!-- else if there are no comments yet and user is currently previewing comment, display it (but only if there is no error) -->
<txp:else />

    <txp:if_comments_preview>
        <section id="comments-head">
            <h3>
                <txp:text item="comments" />
            </h3>
            <ol class="comments-list">
                <li>
                    <p id="cpreview">
                        <txp:text item="press_preview_then_submit" />
                    </p>

                    <!-- links by default to form: 'comments.comment.txp' unless you specify a different form -->
                    <txp:comments_preview wraptag="" />

                </li>
            </ol>

<!-- else just display that there are simply no comments whatsoever :( ...but only if comments are allowed -->
    <txp:else />

        <txp:if_comments_allowed>
            <section id="comments-head">
                <h3>
                    <txp:text item="comments" />
                </h3>
                <p>
                    <txp:text item="no_comments" />
                </p>

        </txp:if_comments_allowed>
    </txp:if_comments_preview>
</txp:if_comments>

<!-- next, if new comments are allowed for this article then display comment form -->
<txp:if_comments_allowed>

    <section id="comments-form">

        <!-- comment invite text is taken for the article's comment invitation field on the 'write' screen -->
        <h3>
            <txp:comments_invite showcount="0" textonly="1" showalways="1" />
        </h3>

        <!-- links by default to form: 'comment_form.comment.txp' unless you specify a different form -->
        <txp:comments_form isize="32" msgcols="64" msgrows="4" />

    </section>

<!-- else display a comments expired message ...but only if comments had previously been allowed -->
<txp:else />

    <txp:if_comments>
        <p>
            <strong>
                <txp:text item="comments_expired" />
            </strong>
        </p>
    </txp:if_comments>

</txp:if_comments_allowed>

<!-- if a comments section was rendered above, close the tag -->
<txp:if_comments>
    </section>
<txp:else />
    <txp:if_comments_allowed>
        </section>
    </txp:if_comments_allowed>
</txp:if_comments>

Author