Forums

mod_chronocomments : "true" latest comments

gbx 11 Sep, 2008
Hi,

In helper.php replace

$query = "SELECT * FROM #__chrono_comments WHERE published='1' AND verify='1' ORDER BY datetime ASC LIMIT 0,".$params->get( 'commentscount', 5 );

by something like this

$query = "SELECT count(id) FROM #__chrono_comments WHERE published='1' AND verify='1'";
$database->setQuery( $query );
$totalComments = $database->loadResult();
$commentsCount = $params->get( 'commentscount', 5 );
$startComment = 0;
if($totalComments > $commentsCount)
  $startComment = $totalComments - $commentsCount;
$query = "SELECT * FROM #__chrono_comments WHERE published='1' AND verify='1' ORDER BY datetime ASC LIMIT ".$startComment.",".$commentsCount;

Best regards,
gbx
Max_admin 12 Sep, 2008
Hi gbx,

good fix, but its because the datetime is ordered ASC, DESC would fix it ? we have another module version here in the forums, sorry but I still didn't finish it and put it in the downloads, it has an ASC/DESC switch!

Regards

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
gbx 12 Sep, 2008
Hi Max,

It's true that Joomla!'s blog layout for exemple (and many modules), display last "post" on top.
For me, a "latest comments module" is different because, in some cases, it's like a discussion (elements are chained like in the detail view) and my reading direction is left to right and top to bottom...
So I think DESC disrupts reading.
[list]
last comment
last-1 comment
last-2 comment
last-3 comment
last-4 comment
[/list]
personally I prefer...
[list]
last-4 comment
last-3 comment
last-2 comment
last-1 comment
last comment
[/list]
It's just my opinion😉

Regards,
gbx
Max_admin 12 Sep, 2008
got it🙂
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.

VPS & Email Hosting 20% discount
hostinger