Albums Views on the main page Albums Views on the main page
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Albums Views on the main page

Started by Butterfly., October 21, 2015, 08:01:37 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Butterfly.

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

Αndré

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;
                }
            }