Display Number of Album Views & Total Number of Image Views in Album Display Number of Album Views & Total Number of Image Views in Album
 

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

Display Number of Album Views & Total Number of Image Views in Album

Started by Rainakthx, May 30, 2013, 05:56:59 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Rainakthx

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

ΑndrĂ©

Open index.php, find
$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
$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
$alb_list[$alb_idx]['alb_hits'] = sprintf($lang_list_albums['alb_hits'], $alb_hits);
and replace both matches with
$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
            $alb_list[$aid]['alb_hits'] = sprintf($lang_list_albums['alb_hits'], $album['alb_hits']);
and replace both matches with
            $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';