Limit the number of pictures displayed in the "most viewed" and "top rated" Limit the number of pictures displayed in the "most viewed" and "top rated"
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Limit the number of pictures displayed in the "most viewed" and "top rated"

Started by T3rry, November 10, 2004, 08:11:30 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

T3rry

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.

Nibbler

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

T3rry

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

Tranz

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

T3rry

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?

Nibbler

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.

T3rry

will try that, thanks



EDIT: worked flawlessly, thank you very much