Page 1 of 1
[SOLVED]CGFeedBack - recent comments
Posted: Mon Jul 26, 2010 7:49 am
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
Re: CGFeedBack - recent comments
Posted: Mon Jul 26, 2010 4:07 pm
by Dr.CSS
Have you tried the summary parameter?...
[SOLVED]Re: CGFeedBack - recent comments
Posted: Mon Jul 26, 2010 6:21 pm
by square
OMG ! That was a stupid question.

In fact I didn't understand that the summary action would list all the comments.
Thank you
Re: [SOLVED]CGFeedBack - recent comments
Posted: Thu Sep 22, 2011 4:45 am
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?
Re: [SOLVED]CGFeedBack - recent comments
Posted: Thu Sep 22, 2011 10:28 am
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>';
}
Re: [SOLVED]CGFeedBack - recent comments
Posted: Fri Sep 23, 2011 5:20 am
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!
Re: [SOLVED]CGFeedBack - recent comments
Posted: Sun Feb 12, 2012 9:55 pm
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
Re: [SOLVED]CGFeedBack - recent comments
Posted: Mon Feb 13, 2012 10:47 pm
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
Re: [SOLVED]CGFeedBack - recent comments
Posted: Tue Feb 14, 2012 8:32 pm
by zounars
Thanks alot, it's working