[SOLVED] CGFeedback No Comments Message

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
richardjkeys
Forum Members
Forum Members
Posts: 15
Joined: Mon Sep 27, 2010 12:14 pm

[SOLVED] CGFeedback No Comments Message

Post 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
Last edited by richardjkeys on Thu Oct 14, 2010 2:39 pm, edited 1 time in total.
Peciura

Re: CGFeedback No Comments Message

Post 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}
richardjkeys
Forum Members
Forum Members
Posts: 15
Joined: Mon Sep 27, 2010 12:14 pm

Re: CGFeedback No Comments Message

Post by richardjkeys »

Works great, many thanks again!
Post Reply

Return to “Modules/Add-Ons”