forum.coppermine-gallery.net

Support => Older/other versions => cpg1.2 Standalone Support => Topic started by: Asobig on December 31, 2003, 01:44:38 pm

Title: Reduce 'most viewed' filelist
Post by: Asobig on December 31, 2003, 01:44:38 pm
Is it possible to reduce the number of most viewed files to lets say the top 100.
Now all my files are in de most viewed list (1000 pictures), but i only want to see the top 100.
Title: Reduce 'most viewed' filelist
Post by: Jelem on January 02, 2004, 11:49:27 am
Yes, I have the same question.
In addition: is it possible to reduce also the pictures in "last uploads"?
Title: Reduce 'most viewed' filelist
Post by: Joachim Müller on January 02, 2004, 11:55:18 am
out-of-the-box: no and no. Why does it bother you? They're both meta-albums, no space is wasted, it's just a query...
If you really need it removed you'll have to modify the queries accordingly (I won't look into this because I don't see any sense in this request).

GauGau
Title: Reduce 'most viewed' filelist
Post by: klaws on January 02, 2004, 01:18:59 pm
You probally could do it using the "TOP" query function in sql..

i'm sure it would work..

but then again i agree on it doesnt matter if theres a top 100, 1000 or all pictures..
Title: Reduce 'most viewed' filelist
Post by: hyperion on January 02, 2004, 05:30:26 pm
You might also look into adding a LIMIT restriction to the SQL query.
Title: Reduce 'most viewed' filelist
Post by: kanghe on February 06, 2004, 09:47:26 pm
I would like to know what query this is, because it does eat a lot of bandwith when somebody chooses the Most Viewed option and there are several thousand thumbnails that have to be shown.
Title: Reduce 'most viewed' filelist
Post by: Casper on February 06, 2004, 09:53:48 pm
To reduce the number of pics shown in the last upoads on the front page, just remove the ',2' after 'lastup' in the contents of main page, in config.
Title: Reduce 'most viewed' filelist
Post by: hyperion on February 07, 2004, 01:53:04 am
The query can be found in /include/functions.inc.php

Find:

Code: [Select]
case 'topn': // Most viewed pictures
Title: Re: Reduce 'most viewed' filelist
Post by: Satrapo on November 25, 2005, 04:33:01 pm
If u don't want to alter the query to limit the number of most viewed pics to only one page of thumbs according with your max tabs configuration find

Code: [Select]
       case 'topn': // Most viewed pictures
                if ($ALBUM_SET && $CURRENT_CAT_NAME) {
                        $album_name = $lang_meta_album_names['topn'].' - '. $CURRENT_CAT_NAME;
                } else {
                        $album_name = $lang_meta_album_names['topn'];
                }
                $query ="SELECT COUNT(*) from {$CONFIG['TABLE_PICTURES']} WHERE approved = 'YES' AND hits > 0  $ALBUM_SET $keyword";

                $result = db_query($query);
                $nbEnr = mysql_fetch_array($result);
                $count = $nbEnr[0];
and after add

Code: [Select]
                if ($count > $CONFIG['max_tabs']){
                $count = $CONFIG['max_tabs'];
                }

If you want x pages of most viewed pics set a variable and use it in the code
Ex.: For 3 pages of thumbs

$numofpages = (3 * $CONFIG['max_tabs'])

and so the code to add:

Code: [Select]
                if ($count > $numofpages){
                $count = $numofpages;
                }