Advanced search  

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

Pages: [1]   Go Down

Author Topic: Albums Views on the main page  (Read 2168 times)

0 Members and 1 Guest are viewing this topic.

Butterfly.

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Female
  • Posts: 35
    • Twilight Central
Albums Views on the main page
« 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
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Albums Views on the main page
« Reply #1 on: October 22, 2015, 10:40:39 am »

To sum up the album and file views for the "last updated albums" meta album (lastalb), open include/functions.inc.php, find
Code: [Select]
            if ($set_caption) {
                build_caption($rowset, array('ctime'), 'albums');
            }
and above, add
Code: [Select]
            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;
                }
            }
Logged
Pages: [1]   Go Up
 

Page created in 0.019 seconds with 20 queries.