After upgrading a site from Drupal 5.x to 6.x and upgrading from Views 1 to Views 2, I started getting the following error:

Error: warning: Division by zero in ...relatedcontent.module on line 1436.

when adding showing a specific view in the related content tab for a given node (for example: /node/8227/relatedcontent/13). The view also displayed as empty.

Here's what line 1435-1437 look like:

function _relatedcontent_items_per_page($result, $items_per_page) {
  return ceil(count($result) / $items_per_page);
}

The first thing I tried was going into the "RelatedContent configuration" for the corresponding content type. Under "settings" I changed the "Length of node table:" setting from "All nodes" to 20.

This fixed the problem and the view now displays the appropriate nodes. However, I imagine there should be a way to fix the line at 1436 so the "All nodes" setting for the "Length of node table:" field doesn't generate an error.

CommentFileSizeAuthor
#1 relatedcontent-821878.patch1.29 KBRaphael Apard
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Raphael Apard’s picture

Title: Error: warning: Division by zero in relatedcontent.module on line 1436. » Patch: warning: Division by zero in relatedcontent.module on line 1436.
FileSize
1.29 KB

Here a patch to fix this issue and allows to display all nodes on the same page.

Naiya’s picture

thank You for Your patch, it is working ad hoc - if any problem appear i let You know.