Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Comment count
Hi there,
I’m having some problems getting the comment count to work as I want it to. What I am trying to achieve is this:
If comments open and some comments
Date . Permalink . Comment Invite (comment_count so far)
If comments open and no comments
Date . Permalink . Comment Invite
If comments closed
Date. Permalink. Comments closed.
At present the code in the form is
<p style="font-size: 12px; margin-top: -20px;"><txp:posted gmt="1" /> · <txp:permlink>Permalink</txp:permlink><txp:if_comments_allowed> · <img src="../assets/images/comments_add.png" width="16" heigh="16" alt="Add a comment" /> <a href="<txp:permlink />#cpreview" title="Leave a comment">Comment (<txp:comments_count />)</a></txp:if_comments_allowed><txp:if_comments_disallowed> · <img src="../assets/images/no_comments.png" width="16" heigh="16" alt="" /> <txp:comments_count /> comments</txp:if_comments_disallowed></p>
The problem being, that the output for 0 comments is:
Saturday February 19, 2005 · Permalink · 0 comments (for an article with comments disabled)
What am I doing wrong?
Cheers,
Sajid
Offline
#2 2007-05-14 22:10:04
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Comment count
You can wrap the <txp:comments_count />
in <txp:if_comments>...</txp:if_comments>
. This way it will only show the comments count if there are any comments. txp:if_comments
Last edited by els (2007-05-14 22:11:42)
Offline
Pages: 1