I've made changes in CMSms to support Most Popular News feature. It works by counting the hits on news.
1) execute this SQL in your CMSms database:
Code: Select all
ALTER TABLE `cms_module_news` ADD `hits` INT( 11 ) UNSIGNED NOT NULL DEFAULT '0';
Just after this code:
Code: Select all
if ($row)
{
$onerow = new stdClass();
Code: Select all
$sql = "UPDATE ".cms_db_prefix()."module_news SET hits=hits+1 WHERE news_id = ".
$row['news_id'];
$db->Execute($sql);
Code: Select all
global $gCms;
$db = &$gCms->db;
$result = array();
$q = "SELECT news_title FROM `cms_module_news` ORDER BY hits DESC LIMIT 5";
$dbresult = $db->Execute( $q );
if( $dbresult ) {
while ( $row = $dbresult->FetchRow() ) {
array_push($result, $row['news_title']);
}
}
echo implode(",", $result);