Forum

Thread tagged as: Question, Problem, Blog

Can't use postTitle and postCommentCount in template comment.html

Hello,

I would like to display the post title and the numbers of comments of a post in the comment section of my blog (using comment.html template) but nothing displays.

Here is my template :

<perch:before>
<p class="h2" id="commentaires">Réactions</p>
<p class="reactions">Il y a <perch:blog id="postCommentCount" /> réaction<perch:if id="postCommentCount" match="gt" value="1">s</perch:if> à l'article "<perch:blog id="postTitle" />".</p>
<ol class="commentslist">
</perch:before>
    <li id="commentaire<perch:blog id="commentID" type="hidden" />">
        <article>
            <header>
                <p class="comentauthor"><span class="glyphicon glyphicon-user"></span> De <perch:if exists="commentURL"><a href="<perch:blog id="commentURL" type="url" label="URL" order="3" />"></perch:if><perch:blog id="commentName" type="text" label="Name" order="1" required="true" /><perch:if exists="commentURL"></a></perch:if></p>
                <p class="commentdate"><span class="glyphicon glyphicon-calendar"></span> <a href="#commentaire<perch:blog id="commentID" type="hidden" />">Le <perch:blog id="commentDateTime" format="%d %b %Y %X" type="date" time="true" label="Date" /></a></p>
            </header>
            <section>
                <perch:blog id="commentHTML" encode="false" html="true" type="textarea" label="Message (HTML)" required="true" />
            </section>
        </article>
    </li>
<perch:after>
</ol>
</perch:after>

How can I display postTitle and postCommentCount ? It works on my post.html template.

Christophe Cussigh-Denis

Christophe Cussigh-Denis 0 points

  • 7 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

If it's not available, you'll need to pass it in.

https://docs.grabaperch.com/docs/templates/passing-variables-into-templates/