If no comments, display "post a comment"

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
Mangek
Regular
Posts: 85
Joined: Tue Jun 24, 2008 1:08 am
Location: Sweden
Contact:

If no comments, display "post a comment"

Post 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. :-]
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

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

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Mangek
Regular
Posts: 85
Joined: Tue Jun 24, 2008 1:08 am
Location: Sweden
Contact:

Post by Mangek »

Wow Garvin, that was a really fast and helpful reply!

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