Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

JoomlaTune Support Forum    JComments component    Bug-reports    Topic: pagination calculations
Pages: [1]   Go Down
  Print  
Author Topic: pagination calculations  (Read 1908 times)
0 Members and 2 Guests are viewing this topic.
blanxd
Newbie
*

Karma: 0
Offline Offline

Posts: 2


« on: April 25, 2010, 17:58:05 »

Hi.

I'm using 2.1.0.0 with "flat" layout, displaying "Most recent first". Noticed that when total comments count exceeds "Comments per page" * "Maximum pages", it increases the "Comments per page" setting quietly, in order to be able to show all the posts, which is absolutely fantastic. But now, the new "Comments per page" amount gets applied to all pages, until the Count winds down to zero, and then the last pages won't show anything, because all the first ones have "Comments per page" + "some increment" posts on them.

Perhaps it's some coincidence of my configuration, but I suspect it might not be, so here is how I solved it for now:
com_jcomments/jcomments.php
Code:
*** 552,557 ****
--- 552,558 ----
  && ($total_pages > $comments_page_limit)) {
  $total_pages = $comments_page_limit;
  $comments_per_page = ceil($total / $total_pages);
+ if (ceil($total / $comments_per_page) < $total_pages) $total_pages = ceil($total / $comments_per_page);
  }
 
  if ($page <= 0) {
So now it decreases the page count until there are more posts again.

br,
Mait
Logged
smart
Administrator
Hero Member
*****

Karma: 160
Offline Offline

Gender: Male
Posts: 2559



WWW
« Reply #1 on: April 26, 2010, 02:38:09 »

Hm, could you provide some example to illustrate the problem?

I've make some tests but didn't found any problems.

If we've next settings: comments per page is 2 and maximum pages is 2.

when we have 1 comment, we will have 1 page
when we have 2 comments, we will have 1 page
when we have 3 comments, we will have 2 pages (comments per page became equal 2)
when we have 4 comments, we will have 2 pages (comments per page became equal 2)
when we have 5 comments, we will have 2 pages (comments per page became equal 3)

I'll make additional tests and if no problems will be found - this patch will be included in next release.

BTW, we've 2 places with calculation $comments_per_page (getCommentsList and getCommentPage).
« Last Edit: April 26, 2010, 02:55:01 by smart » Logged

If you use JComments, please post a rating and a review at the Joomla! Extensions Directory
blanxd
Newbie
*

Karma: 0
Offline Offline

Posts: 2


« Reply #2 on: April 26, 2010, 04:24:06 »

I guess the quickest test would be 2 comments per page and max 5 pages. It happens once you get to the 11th and 12th comment, the tab for the 5th page is still there but there are no comments on the 5th until the 13th comment gets posted.

Obviously these are rare circumstances, I don't even care to calculate the possible odds and combinations Smiley I just stumbled upon it when I was testing how many page tabs fit on a particular template.

br,
Mait
Logged
smart
Administrator
Hero Member
*****

Karma: 160
Offline Offline

Gender: Male
Posts: 2559



WWW
« Reply #3 on: April 26, 2010, 18:24:30 »

Ok, thanks. I'll include this patch in the next JComments release
Logged

If you use JComments, please post a rating and a review at the Joomla! Extensions Directory
Pages: [1]   Go Up
  Print  
JoomlaTune Support Forum    JComments component    Bug-reports    Topic: pagination calculations
 
Jump to: