Node body does not handle <!--break--> properly
jcfiala - December 18, 2008 - 04:03
| Project: | Views |
| Version: | 6.x-2.2 |
| Component: | Miscellaneous |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | duplicate |
Description
Hi.
I've got a simple little view - show all nodes of type X in a row - displaying the node title and body. One of the nodes, I put <!--break--> into the body to set where the teaser would end, and the view is displaying it in the text. I'm looking around, but I don't see a setting to control if that's displayed - I'd imagine it wouldn't want to be shown.
Help?

#1
Hm. It's possible the Node: Body field needs to filter the break out specifically, since it's handled specially.
#2
I'm having this same problem - where would I add a filter to take out the text in the Node: Body field?
#3
Yeah, same issue. I'm just using the Node->Body filed in a panel view and am using the Body field as the only field in the particular view, and it shows the break tag. Would be nice to keep it from showing that.
#4
can you exposed the view?
#5
I have the same problem.
I am using Page View and Row Style = Fields.
Moreover I have some additional thoughts about combination which produces such behavior:
I have WYSIWYG Api with TineMCE installed. When
<!--break-->is inserted in Full HTML Mode through TinyMCE button - it is always enclosed inside<p> .... </p>tags - this causes<!--break-->be outputted in a view field Node->body as<--break-->. At the same time if using Row Style = Node text displays correctly.If I use Filtered HTML without TinyMCE and simply place
<!--break-->in node text - it's displayed correctly in both cases ( Row Style = Fields and Row Style = Fields ) without any problems.dereine:
how can I expose view if it's still needed? If I make export view and post there - is it enough?
#6
I solved this issue by going into my Input Filter settings and disabling the HTML corrector Filter.
1. go to admin/settings/filters/list and click 'configure' next to the Input format in question
2. in the Filters fieldset, un-check HTML corrector
3. save configuration
The HTML corrector 'Corrects faulty and chopped off HTML in postings'. So, if you're relying on this setting to close tags within the teaser then this may not be the best solution.
A scenario might be - you split your node body inside an H1 tag (it's a bad practice, but a good example) - you are using the teaser in a block view. The H1 will not get closed and may wreak havoc on the remaining content in the site.
It should work fine if your teaser consists of HTML tags that are closed:
<p>My teaser text</p>Shawn
#7
Yup, shawngo's answer worked for me. Thanks.
#8
#9
#6/shawngo's answer fixed it for me as well... I'm still a little unsure about all the different input format settings... people say I shouldn't set the default to full html... however, if I don't, then the user must explicitly set full HTML every single time he/she makes a new post using a WYSIWYG tool.
#10
I believe the answer would be to patch views_handler_field_markup to automatically remove
<!--break-->prior to running it through markup. That will at least make sure it's not visible.#11
This looks like a manifestation of #222926: htmlcorrector filter escapes HTML comments.
#12
If this is due to #222926: htmlcorrector filter escapes HTML comments, should we move it to the Drupal filter.module issue queue? I can confirm that the patch in #222926-66: htmlcorrector filter escapes HTML comments fixes this issue for me in regular teaser views, although I haven't tested it on views created by the Views module.
#13
Yes that patch needs to be tested on Views module views. If it fixes the problem reported here then this issue can be marked duplicate of the other.
Another way to check if we have the same issue is to turn off the htmlcorrector filter from the relevant input format(s). Actually #6 confirms that that is the case.
However arguably <!--break--> *should* be stripped from the node body anyway (like node.module does), thereby removing it from the page source.
#14
subscribe (can confirm that disabling htmcorrector is a workaround)
#15
Just for information: I have made a D6 module that can be used to overcome this problem. See http://drupal.org/project/htmlcomment.
#16
Thank you to merlinofchaos (#10) and gpk (#13) for the solution.
There is the patch.
Thank you.
Alexis Wilke
P.S. Remove the HTML corrector at your own risk!
P.P.S. use http://drupal.org/project/htmlcomment only if you know what you're doing! The reason why the core prevents comments is because they are dangerous. Hackers can use them to enter bad code in your site.
#17
This is also an issue with the RSS display. I'm not sure if the patch fixes that.
#18
ppatriotis,
Can you test and let us know?
Thank you!
Alexis
#19
Duplicate of #222926: htmlcorrector filter escapes HTML comments