Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2006-04-27 10:48:57
- Konijn
- Member
- Registered: 2005-06-18
- Posts: 33
Comments count problem
Hey,
When i use <code><txp:comments_count /></code> and there are no comment’s yet, it outputs nothing.
How can I display it 0 ?
Thx
Last edited by Konijn (2006-04-27 10:49:27)
Offline
#2 2006-04-27 11:01:05
- Konijn
- Member
- Registered: 2005-06-18
- Posts: 33
Re: Comments count problem
I added this
<code>
if ($com_count == 0){
return 0;
}else{
return $com_count ;
}
</code>
in taghandlers.php
Offline
Re: Comments count problem
Konijn,
I think another solution could be:
<txp:if_comments><txp:comments_count /><txp:else />0</txp_if_comments>
This way, you dont have to hack any file so when upgrading to a new txp release, you dont have to remember to do the hack:
Offline
#4 2006-04-27 17:20:14
- Konijn
- Member
- Registered: 2005-06-18
- Posts: 33
Re: Comments count problem
I tried to use it, but it didn’t returned the comments_count.
Offline
Re: Comments count problem
Oh!
It worked for me.
Did you put the suggested snippet inside an article form?
Offline
#6 2006-04-27 17:32:17
- Konijn
- Member
- Registered: 2005-06-18
- Posts: 33
Re: Comments count problem
Yes, I will try again.
Offline
Re: Comments count problem
My full snippet is the following:
<pre><code>
<txp:if_comments_allowed>
<li><a href="<txp:permlink />#comentario"><txp:if_comments><txp:comments_count /><txp:else />0</txp:if_comments> <txp:comments_invite textonly="1" showcount="0" /></a></li>
</txp:if_comments_allowed>
</code></pre>
Last edited by maniqui (2006-04-27 17:34:35)
Offline
#8 2006-04-27 17:39:18
- Konijn
- Member
- Registered: 2005-06-18
- Posts: 33
Re: Comments count problem
Thx; it works now.
You can see the result here on my personal site: http://www.freshface.be/
Offline
Pages: 1