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: Display Number of Album Views & Total Number of Image Views in Album  (Read 12619 times)

0 Members and 1 Guest are viewing this topic.

Rainakthx

  • Coppermine newbie
  • Offline Offline
  • Posts: 9

Hi,

I have seen this on a few other galleries and was wondering if someone could tell me how to do it?

In a gallery, where it display the number of album views under the album - I would like it to total all the image views in that album and display it underneath as well.

Can anyone help?

Thanks in advance!

- Raina
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764

Open index.php, find
Code: [Select]
$sql = "SELECT a.aid, count( p.pid ) AS pic_count, max( p.pid ) AS last_pid, max( p.ctime ) AS last_upload, a.keyword, a.alb_hits"and replace both matches with
Code: [Select]
$sql = "SELECT a.aid, count( p.pid ) AS pic_count, max( p.pid ) AS last_pid, max( p.ctime ) AS last_upload, a.keyword, a.alb_hits, sum( p.hits) AS file_hits"
find
Code: [Select]
$alb_list[$alb_idx]['alb_hits'] = sprintf($lang_list_albums['alb_hits'], $alb_hits);and replace both matches with
Code: [Select]
$alb_list[$alb_idx]['alb_hits'] = sprintf($lang_list_albums['alb_hits'], $alb_hits).' / '.($alb_stat['file_hits'] ? $alb_stat['file_hits'] : 0).' file views';
find
Code: [Select]
            $alb_list[$aid]['alb_hits'] = sprintf($lang_list_albums['alb_hits'], $album['alb_hits']);and replace both matches with
Code: [Select]
            $file_hits = mysql_result(cpg_db_query("SELECT SUM(hits) FROM {$CONFIG['TABLE_PICTURES']} WHERE aid = $aid AND approved = 'YES'"), 0);
            $alb_list[$aid]['alb_hits'] = sprintf($lang_list_albums['alb_hits'], $album['alb_hits']).' / '.($file_hits ? $file_hits : 0).' file views';
Logged
Pages: [1]   Go Up
 

Page created in 0.018 seconds with 20 queries.