Search code examples
drupaldrupal-6drupal-viewscck

Drupal, Views: trimming text doesn't work because tags are not closed properly


I have a node with a text area editable with CKEditor. THis means my customer can add italic style with it.

Then I have a VIew in which I'm trimming this text area for each node to 140 characters.

The problem is that if my customer adds italic style right before the treshold, the text is not closed, and I have html errors (for example, the rest of the page is in italic).

Actually the trimming is not working very well becasue it doesn't close the tags after cutting the text.

How can I solve this ? I'm usually very basic functionalities of Drupal.

thanks


Solution

  • Very interesting and I confirm your findings. I made an arbitrary view in the unformatted style that shows node title and node body (which is chopped off at, say, 200 chars). In a particular node body I added the <em> tag that starts before the 200 characters. The ending </em> is much later. When is see the view, you're right -- the <em> is not closed after the trim performed by the views. All text becomes italicized in subsequent rows.

    I've re-opened an old issue on Drupal.org see

    http://drupal.org/node/379354

    I've posted a comment. See http://drupal.org/node/379354#comment-3514064

    Edit: Views is okay after all! This is how your solve your problem:

    Make sure (underneath the trim settings) click on the checkbox [x] Field can contain HTML If checked, HTML corrector will be run to ensure tags are properly closed after trimming.