Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Display Number of Album Views & Total Number of Image Views in Album  (Read 12617 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.019 seconds with 19 queries.