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: Display less last comments  (Read 4977 times)

0 Members and 1 Guest are viewing this topic.

Flipper01

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 38
    • Ibn Battuta
Display less last comments
« on: September 19, 2005, 09:25:43 pm »

I have more than 6000 pictures in my photoalbum and if I want to see the last comments I get 1500 comments (example) wich take a long time to download.
Is it possible to change the number of comments displayed? I tried to edit the functions.inc.php but it didn't work out the way I wanted. Hope someone here can help me out.
« Last Edit: September 20, 2005, 12:56:31 pm by Abbas Ali »
Logged

Nibbler

  • Guest
Re: Display less last comments
« Reply #1 on: September 19, 2005, 09:34:22 pm »

displayimage.php:

Code: [Select]
$result = db_query("SELECT msg_id, msg_author, msg_body, UNIX_TIMESTAMP(msg_date) AS msg_date, author_id, author_md5_id, msg_raw_ip, msg_hdr_ip FROM {$CONFIG['TABLE_COMMENTS']} WHERE pid='$pid' ORDER BY msg_id ASC");
You can add in a limit there:

Code: [Select]
$result = db_query("SELECT msg_id, msg_author, msg_body, UNIX_TIMESTAMP(msg_date) AS msg_date, author_id, author_md5_id, msg_raw_ip, msg_hdr_ip FROM {$CONFIG['TABLE_COMMENTS']} WHERE pid='$pid' ORDER BY msg_id ASC LIMIT xxx");
Logged

Flipper01

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 38
    • Ibn Battuta
Re: Display less last comments
« Reply #2 on: September 19, 2005, 11:02:06 pm »

Hmm I guess you didn't understand my problem.. ;)

The problem wasn't about the comments under my pictures but about the comments that appear when I hit the 'last comments' button.
It now displays 250 rows of thumbnails and that takes a long time to load. I hope it is possible to change the 250 rows in 25 or so.

My gallery: http://w3.frw.rug.nl/ibn/7.fotoboek/
My last comments: http://w3.frw.rug.nl/ibn/7.fotoboek/thumbnails.php?album=lastcom

Nibbler

  • Guest
Re: Display less last comments
« Reply #3 on: September 19, 2005, 11:05:37 pm »

It will display as many rows as you have set to be displayed in config.
Logged

Flipper01

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 38
    • Ibn Battuta
Re: Display less last comments
« Reply #4 on: September 20, 2005, 09:46:03 am »

It will display as many rows as you have set to be displayed in config.
I was afraid of that, but isn't it possible to change that number of rows when displaying the last comments?

I tried to edit line 537 of functions.inc.php:
Code: [Select]
$result = db_query("SELECT $select_columns FROM {$CONFIG['TABLE_COMMENTS']} as c, {$CONFIG['TABLE_PICTURES']} as p WHERE approved = 'YES' AND c.pid = p.pid $keyword $TMP_SET ORDER by msg_id DESC $limit");to:
Code: [Select]
$result = db_query("SELECT $select_columns FROM {$CONFIG['TABLE_COMMENTS']} as c, {$CONFIG['TABLE_PICTURES']} as p WHERE approved = 'YES' AND c.pid = p.pid $keyword $TMP_SET ORDER by msg_id DESC LIMIT 0,50");
This only displays the last 50 comments, but with that come some problems:
- if you click on one of the pictures to read the full comment you end up with the picture with the last comment
- if you select one of the other pages at the bottom of the last comm page you still get the last 50 comments

I hope it is possible to change this without changing the number of rows displayed in albums

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: Display less last comments
« Reply #5 on: September 20, 2005, 10:16:15 am »

I don't understand your problems... if you've set 250 rows in config then it's slow for all pages you let coppermine display... browsing the last uploads eg will bring up (I assume) 250x4 thumbs, same for the last comments. And the lil bit more text is neglectable

Flipper01

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 38
    • Ibn Battuta
Re: Display less last comments
« Reply #6 on: September 20, 2005, 10:24:21 am »

I don't understand your problems... if you've set 250 rows in config then it's slow for all pages you let coppermine display... browsing the last uploads eg will bring up (I assume) 250x4 thumbs, same for the last comments. And the lil bit more text is neglectable

Therefore I don't display the last uploads. The 250 rows are set for gallery's with lots of pictures (so that people can see all pictures at once), but the average album contains 50 pictures.
So there is a big difference between browsing a normal gallery or watching all the last comments.

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Display less last comments
« Reply #7 on: September 20, 2005, 10:35:48 am »

having 250 rows just is a silly setting. If you insist to keep it, you'll have to live with the other drawbacks.
Logged

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: Display less last comments
« Reply #8 on: September 20, 2005, 10:37:26 am »

still.... I let cpg display 8 rows x 2 columns => 16 thumbs... and that loads fast. If visitors want to see more they click one of the tabs, or next/ prev for more thumbnails. That's far less annoying than to have to wait several minutes (there are still guys without ADSL)... and why push 1mb data in thumbnails if the guy just wants to see a single pic? It's like driving a tank for shopping
However... if you want to change that 'behaviour' then have someone modify your coppermine. It's not that hard to do

Flipper01

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 38
    • Ibn Battuta
Re: Display less last comments
« Reply #9 on: September 20, 2005, 11:30:08 am »

having 250 rows just is a silly setting. If you insist to keep it, you'll have to live with the other drawbacks.
Well I'm quite stubborn about that.  ;)
I'd like to display all my thumbs on one page, because the users of my gallery are quite clumsy with computers/internet and therefore I want to make it as easy as possible (I'm afraid they don't click further to the other pages).

I had hoped there was an easy way to change the number of rows displayed at the last comments, but I guess I'll have to leave it this way.

Abbas Ali

  • Administrator
  • Coppermine addict
  • *****
  • Country: in
  • Offline Offline
  • Gender: Male
  • Posts: 2165
  • Spread the PHP Web
    • Ranium Systems
Re: Display less last comments
« Reply #10 on: September 20, 2005, 12:14:42 pm »

No you don't have to leave it :)

First revert the query and remove that LIMIT from it (i mean make it as it was originally).

Edit thumbnails.php file. (Take a backup before editing)

Find

Code: [Select]
display_thumbnails($album, (isset($cat) ? $cat : 0), $page, $CONFIG['thumbcols'], $CONFIG['thumbrows'], true);

and REPLACE it with

Code: [Select]
if ($album == "lastcom") {
  $thumbrows = 5;  // Change this value to whatever you want.
} else {
  $thumbrows = $CONFIG['thumbrows'];
}
display_thumbnails($album, (isset($cat) ? $cat : 0), $page, $CONFIG['thumbcols'], $thumbrows, true);

Above code will dislplay only 5 rows. You can change it to whatever you like.

This will apply only to Last Comments and all other meta albums like Last Uploads etc.. will still have 250 rows.

I hope this is what you wanted.
Logged
Chief Geek at Ranium Systems

Flipper01

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 38
    • Ibn Battuta
Re: Display less last comments
« Reply #11 on: September 20, 2005, 12:48:38 pm »

Awesome!  ;D

Thanks a lot Abbas Ali, this was just what I was looking for!
Pages: [1]   Go Up
 

Page created in 0.023 seconds with 19 queries.