Page 1 of 1

If no comments, display "post a comment"

Posted: Wed Jun 25, 2008 2:52 pm
by Mangek
Hey guys, my first post and I'd like to take the opportunity to thank you for this wonderful software. :-]

Now to my question, is there a way to have uncommented threads show "Post comment" instead of "Comments (0)" ?

I tried fiddling a little with the smarty code (I think?) but I'm not all that good with the syntax. Here's what I tried:

Code: Select all

{if $entry.has_comments}
			<br/><a href="{$entry.link}#comments">{$entry.label_comments} ({$entry.comments})</a>
		{else}
			<br /><a href="{$entry.link}#comments">Post a comment</a>
{/if}
It displays "Post a comment" regardless if there are any comments or not. Any suggestions would be greatly appreciated. :-]

Re: If no comments, display "post a comment"

Posted: Wed Jun 25, 2008 2:54 pm
by garvinhicking
Hi!

Maybe the "has_comments" is only used to indicate whether comments are allowed. Try this:

Code: Select all

{if $entry.comments > 0}
 <br/><a href="{$entry.link}#comments">{$entry.label_comments} ({$entry.comments})</a>
{else}
<br /><a href="{$entry.link}#comments">Post a comment</a>
{/if}
HTH,
Garvin

Posted: Wed Jun 25, 2008 2:56 pm
by Mangek
Wow Garvin, that was a really fast and helpful reply!

Thank you so much, that worked great! :-]]