Is there a way to change the gallery's overall views? Is there a way to change the gallery's overall views?
 

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

Is there a way to change the gallery's overall views?

Started by NewYorkIslander10, December 12, 2015, 02:05:36 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

NewYorkIslander10

Where it says categories with number amount of comments then viewed a number of times is there a way to change that viewed number?


Sorry if I'm posting in the wrong place.

NewYorkIslander10


Αndré

How exactly should it be changed? It's simply the sum of all picture views in your gallery. Of course it could be modified, but I just wonder why you want to do this.


Αndré

There are several ways:
1. Adjust the view counter of each picture manually in the database
2. Set (or multiply) the view counter of each picture automatically, with an appropriate database query
3. Keep the actual view counters of the pictures as they are, but manipulate the output (multiply or set a number)

NewYorkIslander10

How do I do it where you stated I keep the view count but I manipulate the output?

Αndré

Open index.php, find
            $sql = "SELECT SUM(hits) FROM {$CONFIG['TABLE_PICTURES']}";

            if ($pic_filter) {
                $sql .= " AS p INNER JOIN {$CONFIG['TABLE_ALBUMS']} AS a ON a.aid = p.aid WHERE approved = 'YES' $pic_filter";
            } else {
                $sql .= " WHERE approved = 'YES'";
            }

            $result = cpg_db_query($sql);
            $nbEnr = mysql_fetch_row($result);
            $hit_count = (int)$nbEnr[0];
            mysql_free_result($result);

and replace with
            $hit_count = 123456;

Αndré


NewYorkIslander10

Will the gallerys overall views be stayed at this number you gave or will it add up when people visit the gallery?  --->      $hit_count = 123456;

Αndré

It won't change with the current mod. If you want to add or multiply the actual views, undo the last mod. Instead, find
            $hit_count = (int)$nbEnr[0];
and replace with
            $hit_count = (int)$nbEnr[0];
            $hit_count = $hit_count + 1234;

or
            $hit_count = (int)$nbEnr[0];
            $hit_count = $hit_count * 2;