Page 1 of 2

Number of comments (CGFeedback)

Posted: Mon Aug 24, 2009 11:11 am
by tyu
Hello!
How to display number of comments (CGFeedback module) relevant to a page, in a page template?

Re: Number of comments (CGFeedback)

Posted: Mon Aug 24, 2009 1:20 pm
by jmcgin51
from the CGFeedback Help:
(optional) pagelimit="10000" - Applicable only to the summary action, this parameter specifies the number of comments to display.

Re: Number of comments (CGFeedback)

Posted: Mon Aug 24, 2009 5:19 pm
by tyu
jmcgin51 wrote: from the CGFeedback Help:
(optional) pagelimit="10000" - Applicable only to the summary action, this parameter specifies the number of comments to display.
Hmm. This is the LIMIT for the number of comments to display. But I need the EXACT number of comments which are made for a page.

(Sorry for my English :) )

Re: Number of comments (CGFeedback)

Posted: Mon Aug 24, 2009 5:59 pm
by jmcgin51
how about {$comments|@count}?

(untested, just a guess)

Re: Number of comments (CGFeedback)

Posted: Mon Aug 24, 2009 8:49 pm
by tyu
yes, got it! thank you:)

Re: Number of comments (CGFeedback)

Posted: Mon Aug 24, 2009 9:29 pm
by jmcgin51
cool - sometimes a lucky guess is all it takes...

Re: Number of comments (CGFeedback)

Posted: Tue Nov 03, 2009 9:29 pm
by jwaldeck
That didn't work for me! How did you include this in the template?

My piece of code in the template is:

Code: Select all

{if $entry->summary}
	<div class="CGBlogSummarySummary">
		{eval var=$entry->summary}
	</div>

{else if $entry->content}
{eval var=$entry->content}<br /><a href="{$entry->detail_url}" title="{$entry->title|escape:htmlall}">[Read Entry]</a> - {$comments|@count}
	
{/if}
What am I doing wrong??

Re: Number of comments (CGFeedback)

Posted: Wed Nov 04, 2009 6:09 pm
by paulermo
I've done it in the following way (may be not the optimal but works :))

In my News summary template:

Code: Select all

Number of comments: {CGFeedback key1='News' key2=$entry->id action='summary' summarytemplate='counter'}
And the template called 'counter' is defined in CGFeedback summary templates:

Code: Select all

{$total_records}

Re: Number of comments (CGFeedback)

Posted: Thu Nov 05, 2009 1:56 pm
by derNager
That didn't work for me! How did you include this in the template?
Didn`t work for me too.

I did it the way paulermo said (works)

Perhaps one of the smarty-gurus can help?

Re: Number of comments (CGFeedback)

Posted: Thu Nov 05, 2009 3:12 pm
by RonnyK
I have
{CGFeedback key1="CGBlog" key2=$entry->id action='ratings'}
in the CGBlog summary-template. That returns the # of comments already IIRC...

Ronny

Re: Number of comments (CGFeedback)

Posted: Thu Nov 05, 2009 3:42 pm
by jwaldeck
Hi Ronny, this solution ALMOST worked, but the output is this:

Code: Select all

Number of Comments: 0
Minimum Rating Value: 
Maximum Rating Value: 
Average Rating Value: 
We only wan't "Number of Comments", and therefore paulermo's solution really works, but calls the CGEFeedback twice and we'd like to know if this is necessary.

Cheers guys!
jw

Re: Number of comments (CGFeedback)

Posted: Thu Nov 05, 2009 3:46 pm
by RonnyK
It uses the ratings=template, so you can take a copy of that one in CGFeedback, and remove the things you dont want to see.

Ronny

Re: Number of comments (CGFeedback)

Posted: Thu Nov 05, 2009 3:56 pm
by derNager
Jeo i did that but it still doesnt work for me.
I removed all things i dont need and it always shows "Anzahl der Kommentare 0" (thats german for comments 0 :-) )
Is it important where i input {CGFeedback key1="CGBlog" key2=$entry->id action='ratings'} ?

Or if the site is cached or not?

Re: Number of comments (CGFeedback)

Posted: Thu Nov 05, 2009 4:04 pm
by jwaldeck
Tks Ronny, that worked!! :) (I didn't see the Ratings template before, sorry)

Nager,

make sure your KEY1 ("CGBlog" or any other name) is the same you are using everywhere you use the Feedback module: {CGFeedback key1="CGBlog" key2=$entry->id action='ratings'} - Otherwise it will always say "0 comments"!

PS - ich weiss was "Anzahl der Komentare" heisst! :)

Re: Number of comments (CGFeedback)

Posted: Thu Nov 05, 2009 4:10 pm
by derNager
Finally thanks Ronny & jwaldeck :)

bad copy and paste. I use the News Modul not CGblog.... Now everything is fine. thanks a lot

Ps: Wenn man jetzt wüste was "Ich nehme alles zurück und behaupte das Gegenteil" auf English heisst.

I think this is solved.