Page 1 of 1

[SOLVED] CGFeedback No Comments Message

Posted: Thu Oct 07, 2010 11:48 pm
by richardjkeys
Hi,

I'd like to print a message if there are no comments; for example: "There are currently no comments for this article."

I thought it would go in my summary template:

Code: Select all

{if isset($comments)}
{foreach from=$comments item='one'}
	<div class="comment">
		<p class="commentTitle">{$one.author_name}</p>
<p class="commentDate">{$one.created|date_format:"%d %B %Y"}</p>
		<p class="commentDescription">{$one.data|htmlspecialchars}</p>
	</div>
{/foreach}
{/if}
However, it seems that this template isn't called if there are no comments...

Has anyone done anything similar to this?

Regards,

Rich

Re: CGFeedback No Comments Message

Posted: Fri Oct 08, 2010 6:56 pm
by Peciura
If it is not called do as follows
{capture assign='tmp'}{CGFeedback key1="News" key2=$entry->id}{/capture}

{if empty($tmp)}
  No comments
{else}
  {$tmp}
{/if}

Re: CGFeedback No Comments Message

Posted: Thu Oct 14, 2010 2:39 pm
by richardjkeys
Works great, many thanks again!