coppermine-gallery.com/forum

Support => cpg1.5.x Support => cpg1.5 miscellaneous => Topic started by: Butterfly. on October 21, 2015, 08:01:37 PM

Title: Albums Views on the main page
Post by: Butterfly. on October 21, 2015, 08:01:37 PM
Hello,

I noticed that this website: http://jamie-dornan.org/gallery/index.php added under the albums the views but the views are not the number times of the albums were viewed, but it's the total of the views in the inside.

Does anyone know how to do that please ?

Woudl be a life savior.

Thanks a lot
Title: Re: Albums Views on the main page
Post by: Αndré on October 22, 2015, 10:40:39 AM
Quote from: Αndré on February 11, 2014, 11:29:52 AM
To sum up the album and file views for the "last updated albums" meta album (lastalb), open include/functions.inc.php, find
            if ($set_caption) {
                build_caption($rowset, array('ctime'), 'albums');
            }

and above, add
            foreach ($rowset as $key => $album) {
                if ($alb_keyword = mysql_result(cpg_db_query("SELECT keyword FROM {$CONFIG['TABLE_ALBUMS']} WHERE aid = {$album['aid']} LIMIT 1"), 0)) {
                    $keyword = "OR keywords LIKE '%$alb_keyword%'";
                } else {
                    $keyword = '';
                }
                if ($file_hits = mysql_result(cpg_db_query("SELECT SUM(hits) FROM {$CONFIG['TABLE_PICTURES']} WHERE aid = {$album['aid']} AND approved = 'YES' $keyword"), 0)) {
                    $rowset[$key]['alb_hits'] += $file_hits;
                }
            }