Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Limit the number of pictures displayed in the "most viewed" and "top rated"  (Read 4307 times)

0 Members and 1 Guest are viewing this topic.

T3rry

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 36

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.
« Last Edit: November 10, 2004, 09:38:49 pm by TranzNDance »
Logged

Nibbler

  • Guest

Find the relevent sql query and add LIMIT 40 to it. I can't advise specific code changes to 1.2 any longer.
Logged

T3rry

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 36

unfortunatly i dont have the knowlegde to do this, can anybody else help?
Logged

Tranz

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Female
  • Posts: 6149

You should upgrade to the latest version. Especially if you are going to modify your files, why work with outdated ones?
Logged

T3rry

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 36

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?
Logged

Nibbler

  • Guest

Changes are in functions.inc.php, find:

Code: [Select]
$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

Code: [Select]
$count = 40;
and

Code: [Select]
$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

Code: [Select]
$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.
Logged

T3rry

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 36

will try that, thanks



EDIT: worked flawlessly, thank you very much
« Last Edit: November 10, 2004, 09:17:20 pm by T3rry »
Logged
Pages: [1]   Go Up
 

Page created in 0.022 seconds with 20 queries.