Jump to:
Issue Summary
Hi there,
This is my first issue report (and I'm new to Drupal), forgive me if I make any mistakes. :P
Drupal: v6.6
Theme: Framework (http://drupal.org/project/framework) with some customized CSS, nothing crazy, just a dev/learning site.
Repeatable: Always (at least for me on my set up)
Steps to repeat:
1. Download/install Paging, set user access permissions, etc.
2. Create new filter (I called mine "Filtered HTML w/ Paging").
3. Modify settings in Paging admin panel. Select content type to have settings for. I left everything at default exept the "Paging Separator Widget" (set to button), and "Automatic Paging Method", which was set to "Limit by Characters" and "1500 characters". Save.
4. Edit content of the selected content type, make sure new filter is applied, save.
Expected result: Body copy of content limited and chopped off at the 1500 character limit, pagination interface created, moving to page 2 and beyond shows more content.
Actual result: Page 1 only shows the summary field of the body copy, page 2 and onwards are blank. Paging module seems to be generating the correct paging navigation though, the correct number of pages. It just doesn't show the content.
Other notes/tests:
- Summary field does not seem to get chopped at all, no matter what I set character limit to
- Limiting by Words seems to be working fine, and behaves as expected
---
General newbie question: This "summary" field for the body text of the content, is it mucking up a lot of contributed modules? I ran into some problems when I was playing with one of the WYSIWYG editors.
Comments
#1
No one else having this problem? Just me?
#2
OK, I must be mistaken or some other module is mucking up Paging.
I have a clean install of Drupal and the module seems to be working as expected, supplying page breaks at the end of paragraphs or line breaks as the case may be. I'm not sure which module was causing the problem, it'll take me a while to investigate, but if it pops up again and I can determine the conflict, I'll post back here.
Sorry for the trouble!
#3
Sorry again, my mistake. :/ The bug is still there, and I know why it's happening.
It seems to be related to the summary tag, the manually inserted "
<!--break-->" that Drupal will use to split a piece of content from the body into the teaser field.Here's what I'm seeing...
1. Good: If character count is on, and Drupal left on its own to figure out what the teaser should be, everything works fine.
2. Bad: If character count is on, and I manually put in the
<!--break-->(if using TinyMCE) or use the default "Split at Cursor" functionality (if not using TinyMCE), then the first page shows my teaser content, but everything else after that is blank. It correctly counts the page numbers, just doesn't show anything on the pages except the first, which just shows the teaser.3. Good: If character count is on, and I insert my custom manual page breaks (I'm using
<!--pagebrk-->, 'cuz I thought the parser might have been confusing "break" and "pagebreak"), and leave out the teaser break, everything works fine.4. Good: If character count is on, and I insert my custom manual page breaks, and put the teaser break in, everything works fine.
(A couple hours go by...)
I started digging into the module code, and I think the problem is inside the _paging_nodeapi() function, inside the "Automatic paging based on character count" logic. There's a for loop that goes through the body content of the article and generates an array, bodypart[], that contains all the portions (pages) of the article.
<?php// Check if pagination is possible.
if ($total_chars > $max_chars) {
$body = $node_body;
$breaks = (int)($total_chars / $max_chars);
$bodypart = array();
for ($i = 0; $i <= $breaks; $i++) {
$bodypart[$i] = node_teaser($body, NULL, $max_chars);
$bodycount = strlen($bodypart[$i]);
$body = substr($body, $bodycount);
}
$body_parts = implode($paging_separator, $bodypart);
}
?>
The code uses node_teaser() (http://api.drupal.org/api/function/node_teaser) to create the page portions. I'm guessing this function does a nice thing by not breaking text in the middle of a paragraph and returns only whole paragraphs.
Problem is, node_teaser() will look for the
<!--break-->delimiter, and then stop there. If your content is using the<!--break-->delimiter, then your first page effectively becomes the teaser. :( Problem #1.Problem #2: Worse still, the
<!--break-->delimiter remains inside of the remainder content of the $body var, which gets redefined at the end of each loop by the substr call above. The substr($body, $bodycount) won't eliminate the delimiter, so next time node_teaser() is called, it will stop again at the<!--break-->and return *nothing* because we already pulled out that content! :P This makes all the remaining page content empty strings.I dunno, maybe I'm missing something here? I think the Paging module needs to be rewritten so it doesn't depend on node_teaser to get page portions. It should implement its own function that ignores the
<!--break-->delimiter.#4
BTW, I implemented my own little hacky, kludgy solution. I just copied the entirety of the node_teaser() function (http://api.drupal.org/api/function/node_teaser) into the paging.module file, renamed it "_create_page_portion()", and changed the line...
<?php// Find where the delimiter is in the body
$delimiter = strpos($body, '<!--break-->');
?>
...to...
<?php$delimiter = FALSE;
$body = str_replace("<!--break-->","",$body);
?>
The first line makes sure the rest of the code (which I didn't want to touch) gets a value for $delimiter when it needs it, and the second was just a safety check on my part to make sure the delimiter isn't there when I'm generating the page portions.
This isn't a really great solution, but it works for now.
Sorry, I'm still new to Drupal dev, haven't sat down and figured out how to make patch files, otherwise I'd upload one. :(
#5
So many days you don't receive answer :( Which modules you have enabled? Can you try to disable some of them only for while to see if they make conflict.
Which text editor you use? I use TinyMCE and don't have these problems. Can you try with tinymce?
#6
See above, I think I found the problem!
#7
Heh, you writed when i wrote :) Great! :) Nice to see that you resolved the problem!
#8
Hehehe, I *found* the problem and created a *hack* for it, but I didn't *fix* it properly. :)
Hope the module maintainer(s) see this and will implement a proper solution that they're happy with.
#9
I'm watching since first report. Just I need to find some time and investigate.
:--)
#10
I have the same problem. If I use and automatic character count I see only teaser at the first page. The other pages are empty.
#11
smacphail, I used your idea as a temporary solution. This works, thanks.
#12
I also used this solution, worked for me!
#13
http://drupal.org/cvs?commit=198798
#14
Automatically closed -- issue fixed for 2 weeks with no activity.