Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2012-04-30 16:23:48

totoff
Member
From: Cologne, Germany
Registered: 2011-04-04
Posts: 145
Website

How to output something like "No comments yet. Write the first"?

hello forum,

sure, this question must have been answered somewhere but as the search terms are very generic i can’t find the solution. i would like to output a message in case there are no comments to an article so far.

this is my comments form:

<p class="small excommentmeta">Kommentar von <txp:comment_name />. <txp:comment_time /></p>
<txp:comment_message />

i tried this but it doesn’t work:

<txp:chh_if_data> <!-- check for comments data -->
	<p class="small excommentmeta">Kommentar von <txp:comment_name />. <txp:comment_time /></p>
	<txp:comment_message />
<txp:else /> <!-- no comments -->
	<p>Bisher keine Kommentare zu dieser Ausstellung. Schreiben Sie den ersten!</p>
</txp:chh_if_data>

thanks for your help!

Offline

#2 2012-04-30 16:30:36

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: How to output something like "No comments yet. Write the first"?

How about something like:

<txp:if_comments_allowed>
  <txp:if_comments>
    ...stuff here...
  <txp:else />
    <p>No comments yet.</p>
  </txp:if_comments>
</txp:if_comments_allowed>

I think that would work.

Last edited by philwareham (2012-04-30 16:31:26)

Offline

#3 2012-04-30 19:23:15

totoff
Member
From: Cologne, Germany
Registered: 2011-04-04
Posts: 145
Website

Re: How to output something like "No comments yet. Write the first"?

hi phil,

that does the trick, thanks.

Offline

Board footer

Powered by FluxBB