Hello.
This extension is fantastic! Thank you!
But is there any way to show the most commented articles? thanks
This extension is fantastic! Thank you!
But is there any way to show the most commented articles? thanks
... the key will be the SQL statement to find the articles with most comments, you may hack the comments module, we can work through this code together here if you like.
$query = "SELECT a.*, b.title AS articletitle FROM #__chrono_comments AS a, #__content AS b WHERE a.pageid = b.id AND a.published='1' AND a.verify='1'".$extra." ORDER BY a.datetime ".$params->get( 'order', 'ASC' )." LIMIT 0,".$params->get( 'commentscount', 5 );
$database->setQuery( $query );
$params->get( 'commentscount', 5 );
and pasted just bellow like this
$database =& JFactory::getDBO();
$commentscount = intval($params->get( 'commentscount', 5 ));
$query = "SELECT a.*, b.title AS articletitle FROM #__chrono_comments AS a, #__content AS b WHERE a.pageid = b.id AND a.published='1' AND a.verify='1'".$extra." ORDER BY a.datetime ".$params->get( 'order', 'ASC' )." LIMIT 0,".$params->get( 'commentscount', 5 );
$database->setQuery( $query );
$query = "SELECT count(a.id) AS most, a.id, a.pageid, b.id AS artid, b.title AS articletitle, b.sectionid AS id_section, b.catid AS id_categorie"
. "\n FROM #__chrono_comments AS a, #__content AS b"
. "\n LEFT JOIN #__content_frontpage AS f ON f.content_id = b.id"
. "\n INNER JOIN #__categories AS cc ON cc.id = b.catid"
. "\n INNER JOIN #__sections AS s ON s.id = b.sectionid"
. "\n WHERE ( b.state = 1 AND b.sectionid > 0 )"
. "\n AND (b.id = a.pageid AND a.published='1')"
. "\n GROUP BY articletitle"
. "\n ORDER BY most DESC";
$database->setQuery( $query,0,$commentscount );