coppermine-gallery.com/forum

Support => Older/other versions => cpg1.3.x Support => Topic started by: T3rry on November 10, 2004, 08:11:30 PM

Title: Limit the number of pictures displayed in the "most viewed" and "top rated"
Post by: T3rry on November 10, 2004, 08:11:30 PM
currently i have 16 pages of photos displayed in the "most viewed" area, is there a way to make it so it only displays say the 40 (1 page on my settings) most viewed files.
Title: Re: Limit the number of pictures displayed in the "most viewed" and "top rated"
Post by: Nibbler on November 10, 2004, 08:20:14 PM
Find the relevent sql query and add LIMIT 40 to it. I can't advise specific code changes to 1.2 any longer.
Title: Re: Limit the number of pictures displayed in the "most viewed" and "top rated"
Post by: T3rry on November 10, 2004, 08:27:57 PM
unfortunatly i dont have the knowlegde to do this, can anybody else help?
Title: Re: Limit the number of pictures displayed in the "most viewed" and "top rated"
Post by: Tranz on November 10, 2004, 08:50:03 PM
You should upgrade to the latest version. Especially if you are going to modify your files, why work with outdated ones?
Title: Re: Limit the number of pictures displayed in the "most viewed" and "top rated"
Post by: T3rry on November 10, 2004, 08:55:09 PM
sorry i just checked and i do have 1.3.2 my mistake sorry, i thought i had installed 1.2 because the new version did not work with the shopping cart system i intended to use... mods could you please move this to the appropreate area?
Title: Re: Limit the number of pictures displayed in the "most viewed" and "top rated"
Post by: Nibbler on November 10, 2004, 09:02:40 PM
Changes are in functions.inc.php, find:

$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];


change to

$count = 40;

and

$result = db_query("SELECT $select_columns FROM {$CONFIG['TABLE_PICTURES']} WHERE approved = 'YES'AND hits > 0 $ALBUM_SET $keyword ORDER BY hits DESC, filename  $limit");

to

$result = db_query("SELECT $select_columns FROM {$CONFIG['TABLE_PICTURES']} WHERE approved = 'YES'AND hits > 0 $ALBUM_SET $keyword ORDER BY hits DESC, filename LIMIT 40");

That's for most viewed - it is almost the same for all meta albums.
Title: Re: Limit the number of pictures displayed in the "most viewed" and "top rated"
Post by: T3rry on November 10, 2004, 09:09:48 PM
will try that, thanks



EDIT: worked flawlessly, thank you very much