forum.coppermine-gallery.net
Support => cpg1.5.x Support => cpg1.5 miscellaneous => Topic started by: NewYorkIslander10 on December 12, 2015, 02:05:36 am
-
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.
-
Can anyone help me or answer?
-
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.
-
How can this be modified?
-
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)
-
How do I do it where you stated I keep the view count but I manipulate the output?
-
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;
-
2. Set (or multiply) the view counter of each picture automatically, with an appropriate database query
Solution here: http://forum.coppermine-gallery.net/index.php/topic,78552.msg380631.html#msg380631
-
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;
-
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;
-
Thanks solved.