[solved] Divide by zero error in news module

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
g5todd
New Member
New Member
Posts: 7
Joined: Fri Sep 14, 2007 9:39 pm

[solved] Divide by zero error in news module

Post by g5todd »

Hello, looking for some help here.

I made no changes to the call to the news module but I'm suddenly getting divide by zero errors in both News module 2.6.1 and 2.7.

Here's the call to News module that has started to fail:

Code: Select all

Action Items {news number="8" detailpage="action-items" category="Action Items" makerssbutton="true"}

{news number="8" detailpage="action-items" category="Action Items" dateformat="%B %e, %Y"}
And the error:

Code: Select all

Warning: Division by zero in /home/cippicc/public_html/modules/News/action.default.php on line 176

Warning: Division by zero in /home/cippicc/public_html/modules/News/action.default.php on line 177
Lines 176-177 correspond to:

Code: Select all

  $pagecount = (int)($count / $pagelimit);
  if( ($count % $pagelimit) != 0 ) $pagecount++;
I noticed that pagelimit defaults to 100000. I don't override pagelimit, but even when I overrode it to pagelimit=10 I still get this issue. I have cleared the cache.

Not sure what else to do at this point, any suggestions? TIA
Last edited by g5todd on Thu Jun 05, 2008 1:31 am, edited 1 time in total.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: Divide by zero error in news module

Post by calguy1000 »

the 'number' paramater is a synonym for pagelimit
however

try this:  add the line:

Code: Select all

if ($pagelimit <= 0 ) $pagelimit = 10000;
directly above that code.
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.
g5todd
New Member
New Member
Posts: 7
Joined: Fri Sep 14, 2007 9:39 pm

Re: Divide by zero error in news module

Post by g5todd »

Thanks for the hint. Unfortunately that seems to kill the news module. The page containing it takes about 30 seconds longer to load, and when it's done loading the news pane is empty.
g5todd
New Member
New Member
Posts: 7
Joined: Fri Sep 14, 2007 9:39 pm

Re: Divide by zero error in news module

Post by g5todd »

Taking out the number parameters gets rid of the error messages and doesn't take as long to load, but unfortunately the news panes wind up being blank. Everything shows up fine in the News editing pages though.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Divide by zero error in news module

Post by Dr.CSS »

Have you tried renaming the alias for the detail page by taking out the - and making the adjustments in your call?
g5todd
New Member
New Member
Posts: 7
Joined: Fri Sep 14, 2007 9:39 pm

Re: [solved] Divide by zero error in news module

Post by g5todd »

Thank you to Ted, calguy1000 and mark.

The issue turned out to be the way the news module was called. Someone edited the page that included the call to the News module and somehow all of the the double quotes wound up being replaced by ". I'm surprised that the news call actually sort-of worked.

Once I changed all the instances of " back to double quotes it worked again.
Post Reply

Return to “CMSMS Core”