coppermine-gallery.com/forum

Support => cpg1.5.x Support => cpg1.5 themes (visuals) => Topic started by: Rainakthx on May 30, 2013, 05:56:59 AM

Title: Display Number of Album Views & Total Number of Image Views in Album
Post by: Rainakthx on May 30, 2013, 05:56:59 AM
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
Title: Re: Display Number of Album Views & Total Number of Image Views in Album
Post by: ΑndrĂ© on May 30, 2013, 10:32:45 AM
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';