coppermine-gallery.com/forum

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:

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


       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


                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:


                if ($count > $numofpages){
                $count = $numofpages;
                }