[SOLVED]CGFeedBack - recent comments

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
square
Forum Members
Forum Members
Posts: 51
Joined: Fri Jan 15, 2010 5:02 pm

[SOLVED]CGFeedBack - recent comments

Post by square »

Hi all,

I'd like to display on the frontend of my site the latest comments. Just as it is in the admin section. I know it's possible but I've never seen it on frontend in any site.

I wonder if assigning the key3 an attribute and calling {CGFeedBack key1="News" key2="something" key3="myattribute"} will work ?

Or maybe you think about another way to proceed. Any thought are welcome.   :)

Have a nice day,

Square
Last edited by square on Mon Jul 26, 2010 6:21 pm, edited 1 time in total.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am
Location: Arizona

Re: CGFeedBack - recent comments

Post by Dr.CSS »

Have you tried the summary parameter?...
square
Forum Members
Forum Members
Posts: 51
Joined: Fri Jan 15, 2010 5:02 pm

[SOLVED]Re: CGFeedBack - recent comments

Post by square »

OMG !  That was a stupid question.  :o
In fact I didn't understand that the summary action would list all the comments.

Thank you
tpsvca
Forum Members
Forum Members
Posts: 14
Joined: Mon Feb 08, 2010 8:22 am

Re: [SOLVED]CGFeedBack - recent comments

Post by tpsvca »

KoluCCi wrote:Actually, I don't understand how to show recent comments (I want to do so for all pages (left-side block)). I've tried action="summary" with key1="__page__" - no effect. I've set up key3 to comm and call module like {CGFeedback key3="comm" action="summary"} - nothing shown.

How can I get latest comments?

CMS Made Simple 1.9.4.2 "Faanui"
CGFeedback 1.3.5
Have the same problem. Someone can help?
applejack
Power Poster
Power Poster
Posts: 1014
Joined: Fri Mar 30, 2007 2:28 am
Location: London

Re: [SOLVED]CGFeedBack - recent comments

Post by applejack »

It doesn't work, it is a bug. I had to write a UDT to get around it in order for comments to be able to appear on any page not just the page they are posted on.

Call the UDT below with {testimonials num=3} num is obviously the number of comments you want to return and

Code: Select all

if(isset($params['num'])) {
      $num = $params['num'];
}

$testimonial_resource = mysql_query("

SELECT author_name as author, data as quote from cms_module_cgfeedback_comments WHERE status='published' ORDER BY RAND() LIMIT $num

") or die(mysql_error());

while ($testimonial = mysql_fetch_assoc($testimonial_resource)) {
$i++;
$smarty->assign("test_quote$i",$testimonial['quote']);
$smarty->assign("test_author$i",$testimonial['author']);
#echo '<p>'.{$show|summarize:3}.'<br /><strong>'.$testimonial['author'].'</strong></p>';
}
then where you want it to appear e.g.

Code: Select all

<p class="quote">{$test_quote1|summarize:25}</p>
<p class="author">{$test_author1}</p>

<p class="quote">{$test_quote2|summarize:25}</p>
<p class="author">{$test_author2}</p>
or use this where you do all the formatting in the UDT

Code: Select all

if(isset($params['num'])) {
      $num = $params['num'];
}

$numwords = 25;

$testimonial_resource = mysql_query("

SELECT author_name as author, data as quote from cms_module_cgfeedback_comments WHERE status='published' ORDER BY RAND() LIMIT $num

") or die(mysql_error());

while ($testimonial = mysql_fetch_assoc($testimonial_resource)) {
preg_match("/(\S+\s*){0,$numwords}/", $testimonial['quote'], $regs);
$shortdesc = trim($regs[0]);
echo '<p>'.$shortdesc.'...<br /><strong>'.$testimonial['author'].'</strong></p>';
}
tpsvca
Forum Members
Forum Members
Posts: 14
Joined: Mon Feb 08, 2010 8:22 am

Re: [SOLVED]CGFeedBack - recent comments

Post by tpsvca »

applejack wrote:It doesn't work, it is a bug. I had to write a UDT to get around it in order for comments to be able to appear on any page not just the page they are posted on.

Call the UDT below with {testimonials num=3} num is obviously the number of comments you want to return and

Code: Select all

if(isset($params['num'])) {
      $num = $params['num'];
}

$testimonial_resource = mysql_query("

SELECT author_name as author, data as quote from cms_module_cgfeedback_comments WHERE status='published' ORDER BY RAND() LIMIT $num

") or die(mysql_error());

while ($testimonial = mysql_fetch_assoc($testimonial_resource)) {
$i++;
$smarty->assign("test_quote$i",$testimonial['quote']);
$smarty->assign("test_author$i",$testimonial['author']);
#echo '<p>'.{$show|summarize:3}.'<br /><strong>'.$testimonial['author'].'</strong></p>';
}
then where you want it to appear e.g.

Code: Select all

<p class="quote">{$test_quote1|summarize:25}</p>
<p class="author">{$test_author1}</p>

<p class="quote">{$test_quote2|summarize:25}</p>
<p class="author">{$test_author2}</p>
or use this where you do all the formatting in the UDT

Code: Select all

if(isset($params['num'])) {
      $num = $params['num'];
}

$numwords = 25;

$testimonial_resource = mysql_query("

SELECT author_name as author, data as quote from cms_module_cgfeedback_comments WHERE status='published' ORDER BY RAND() LIMIT $num

") or die(mysql_error());

while ($testimonial = mysql_fetch_assoc($testimonial_resource)) {
preg_match("/(\S+\s*){0,$numwords}/", $testimonial['quote'], $regs);
$shortdesc = trim($regs[0]);
echo '<p>'.$shortdesc.'...<br /><strong>'.$testimonial['author'].'</strong></p>';
}
Thanks. It's really works. Respect!
User avatar
zounars
Forum Members
Forum Members
Posts: 41
Joined: Tue Jun 20, 2006 11:38 am
Location: Italy

Re: [SOLVED]CGFeedBack - recent comments

Post by zounars »

Hi all,
Excuse me for re-opening this topic.
I have the comments on my home page with the UDT but, How can I transform comments from simple text to link so that clicking them, you can see all the comments and the related article?

Thanks for your help.

CMSMS 1.9.3
CGFeedback 1.5.4
News 2.11.1
CGExtensions 1.27.2
User avatar
polodesign
Forum Members
Forum Members
Posts: 55
Joined: Sun Jan 03, 2010 1:58 am

Re: [SOLVED]CGFeedBack - recent comments

Post by polodesign »

Zounars,

You need to get the URL from the database and insert it in the UDT. This version of the code is working for me:

Code: Select all

if(isset($params['num'])) {
      $num = $params['num'];
}

$testimonial_resource = mysql_query("SELECT author_name as author, title as title, origurl as url, data as quote from module_cgfeedback_comments WHERE key1='CGBlog' ORDER BY RAND() LIMIT $num") or die(mysql_error());

while ($testimonial = mysql_fetch_assoc($testimonial_resource)) {
preg_match("/(\S+\s*){0,$numwords}/", $testimonial['quote'], $regs);
$shortdesc = trim($regs[0]);
echo '<p>'.$testimonial['title'].'<br />'.$shortdesc.'...<br />'.$testimonial['author'].'<br /><a href="'.$testimonial['url'].'">Read more</a></p>';
}

Hope that helps. Thanks to applejack for posting the original code.

Penny
User avatar
zounars
Forum Members
Forum Members
Posts: 41
Joined: Tue Jun 20, 2006 11:38 am
Location: Italy

Re: [SOLVED]CGFeedBack - recent comments

Post by zounars »

Thanks alot, it's working
Post Reply

Return to “Modules/Add-Ons”