News pagination bug - and codefix

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
bigtony
New Member
New Member
Posts: 6
Joined: Sat Oct 21, 2006 9:17 am

News pagination bug - and codefix

Post by bigtony »

Hi. I spotted a pagination error on the News module (v. 2.3) on CMSMS v. 1.1

For example, if you set the option pagelimit="2" and have exactly 2 news items in the database, there should obviously only be 1 page, but it gives the pagination saying there are 2 pages. Clicking to see page 2 gives an empty page.

I have changed the code in action.default.php (around lines 158-159)

FROM:

Code: Select all

$pagecount = intval($row2['count'] / $pagelimit);
if( ($pagecount % $pagelimit) != 0 ) $pagecount++;
TO:

Code: Select all

$pagecount = (intval($row2['count'] / $pagelimit)) + 1;
if( ($row2['count'] % $pagelimit) == 0 ) $pagecount--;
And this seems to fix the paging problem. Hope this helps someone.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: News pagination bug - and codefix

Post by calguy1000 »

I've already fixed it in svn.... it should be available when CMS 1.1.1 comes out.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Post Reply

Return to “CMSMS Core”