I am having a problem after an upgrade to Drupal 6.x. When I edit a node, the teaser is included in the body field. It doesn't appear when I view the node, this only happens when I edit. If I save the node and edit it again, the problem doesn't occur again, new nodes aren't affected neither. This happens using different themes (including Garland), different input formats and with or without Tinymce editor (through WYSIWYG module).
For example, the teaser text is:
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
And the body field:
Suspendisse tempus, mauris non molestie varius, enim nisl tincidunt eros, in aliquam risus massa et elit.
In the editing form, the body field looks like this:
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Suspendisse tempus, mauris non molestie varius, enim nisl tincidunt eros, in aliquam risus massa et elit.The only thing I can think of is that it has to do with the new feature "Show summary in full view". It looks as if the error only occurs when that field is unchecked. Maybe somebody can tell me where that setting is saved in the database so I can investigate? I'm wondering why some nodes have it checked and others not.
This seems to be similar to #347174: Body and Teaser appears together, but the issue was closed without a solution.
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | node-body-teaser-compare.patch | 838 bytes | gnindl |
Comments
Comment #1
yan commentedTo add one more thing: After saving, the option "Show summary in full view" is checked.
Comment #2
yan commentedI found out that the function node_body_field() has something to do with this problem (it's on line 263 in modules/node/node.pages.inc. There it reads:
I don't really understand what that does and why, but in my case $include is empty if the problem occurs and '1' if it doesn't. If I change
to something like
the teaser is (obviously) not included. But I don't understand why Drupal 'thinks' that it actually should be included if "Show summary in full view" is not checked. The teaser field is not empty, although I don't use it (I use a CCK field).
Another option that seems to solve the problem is setting
$include = 1;manually. In that case the problem doesn't occur and "Show summary in full view" is checked.Can anybody help me?
Comment #3
yan commentedI don't know why, but it looks as if this happen anymore although the original entry in modules/node/node.pages.inc is used.
I'm wondering why nobody reacted to this issue for more than a month although it had been marked as 'critical'.
Comment #5
yan commentedI just noticed that the problem persists. Any ideas?
Comment #6
robbrow commentedI wish I had a solution for you, Yan, but unfortunately I am having a similar problem. Node teasers show above nodes even though the checkbox "Show summary in full view" is unchecked.
I initially figured it might be theme issue, but it isn't. I tested in other themes, with the same result. I just looks like the teaser is being passed into $content->body no matter what. I know the checkbox is doing something, however, because when it is unchecked and it shows above the body, it breaks the formatting of the full text. When it is checked, it appears as it should.
If anyone has any ideas about what might be going on, it would greatly be appreciated.
Thanks!
Comment #7
endiku commentedThis is a weird one that has been encountered before #364264: Body/Teaser Discrepancy Problem
Basically if the teaser does not match the body then the teaser is included into the body.
If this is not a bug then perhaps the logic behind this is for instances when the teaser is meant to be completely different from the body and should be included in the body. Teaser is the intro paragraph, body is the rest of the content, view the body and you see the intro then the rest.
I think in Drupal 7 the teaser is becoming its own field and this will probably be more clear but in 6 it's still an issue. If you do a migration or some custom database work and the teasers don't exactly match then it causes some real havoc.
So my suggestion is to clean up your node_revisions.teaser fields however works best to match the body. Maybe clear them out completely if you aren't using them. If you are interested I can provide a function for rebuilding all teasers off the current bodies that I use myself to fix this.
Comment #8
monotaga commentedI found that rebuilding node teasers using retease seems to address this problem. At least on first glance...
Comment #9
AlexisWilke commentedI got that problem today and have a fix, but what you are describing may be different since your case does not include HTML being cut automatically... You may still want to test with my patch here:
#221257: text_summary() should output valid HTML and Unicode text
It changes the function described in #2
Thank you.
Alexis Wilke
Comment #10
jmseigneur commentedSubscribing. I confirm having experienced this issue.
Comment #11
dpearcefl commentedIs this issue fixed in the latest D6? is there any interest in pursuing this issue?
Comment #12
dpearcefl commentedComment #13
gnindl commentedProblem:
Actually the problem is caused by a very dubious feature in D6: the teaser is prepended to the body text if they don't exactly match. It happens when a logged in user opens the node edit form. Then if the user saves the node without examining the body - because she/he is looking at some other form values - suddenly the teaser appears before the body text. In my case it looks like the body text is duplicating. The reason is that the end of the lines in the body text are marked with line feeds (LF, i. e. \n) only whereas the generated teaser transformed them to carriage returns CR and LF (\r\n) in the teaser node_teaser() function. Probably the user pasted - maybe some non UTF8 characters - from Linux into the body.
Proposed solution:
See patch. I propose to just strip all whitespaces as they don't have any relevance for the HTML display anyway. Further we abstract/hide how different OS/applications do whitespacing.
Comment #15
kevinquillen commentedHow can we prevent the teaser from being attached to the body at all on the edit form?
Comment #16
kevinquillen commentedNevermind. Created a nodeapi hook that acts on prepare and unsets the node teaser.
Comment #17
brycefisherfleig commentedkevinquillen, I believe I'm bumping up against the same issue on 6.20. In the absense of a working patch, could you share a code sample on this thread?
Alternatively, if this issue has been patched on another thread, which version of Drupal 6 should I upgrade to get this patch? Thanks!!
EDIT: Here's a code sample just like kevinquillen described. Put this function inside a custom module called "MYMODULE":
Comment #18
kevinquillen commentedI kind of forget how I did it now. I had to do some crazy workaround to get it to not set anything. As #13 said, if the strings don't exactly match it will append it. I think I used nodeapi and a prepare case to unset the teaser, so it would not be used in the form. It did work.
Comment #19
brycefisherfleig commentedThanks, kevinquillen. I just edited my comment in #17 with a code sample that seems to work for me. Hope someone else finds that useful!