Dropped pages
| Project: | Paging |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Jump to:
If using automatic-via-character-count paging there is the potential of losing pages because of the use of node_teaser(). For example if maxcount is say 3000 characters and the node body is 5000 characters paging will decide to be 2 pages, however node_teaser() may decide to make the first page only 1900 characters long because say the next paragraph is too long. That leaves at least 100 characters (and potentially many more) that need to go on a 3rd page that isn't going to get created.
Attached is a patch that fixes that. Included in the patch is some code that will allow any page past the first to combine their results with the previous page if there is very little text on the page (less then 1/10 of maxchars). Maybe thats not needed, but was very useful for me :)
| Attachment | Size |
|---|---|
| paging.module.patch | 1.12 KB |

#1
Was running into the same situation and this patch appears to fix the problem. Thanks!
#2
We recently started using this module and ran into the same issue. The problem lies with the calculation of $breaks and the fact that the loop uses it as a its control variable. The correct algorithm would be to loop until $body is empty. Something like this:
// Check if pagination is possible.if ($total_chars > $max_chars) {
$body = $node_body;
$bodypart = array();
$i = 0;
while ($body) {
$bodypart[$i] = _paging_body_shift($body, $max_chars);
$bodycount = strlen($bodypart[$i]);
$body = substr($body, $bodycount);
$i++;
}
$body_parts = implode($paging_separator, $bodypart);