Help - Search - Members - Calendar
Full Version: trim_to causes invalid html
Movable Type Community Forum > Other Product Discussion > Bugs and Odd Behavior
andrejk
Hi,

I have a list with the latest comments on the index page. These comments are trimmed to 80 characters. This causes a problem when the 80th character is in the middle of a href in a link. The href attribute is opened but never properly closed. The result in mozilla is that the stylesheet is no longer correctly applied as the html has become invalid. It would be nice if the trimming would not cause the html to go invalid.

Thanks,
Andrej
kristine
Rather than just using trim_to, you can add remove_html in the tag as well:
CODE
<$MTCommentBody trim_to="80" remove_html="1"$>


That will prevent this from being a problem. Usually, I only use trim_to on fields that I know html will not be used in. smile.gif

You could also use the FirstNWords plugin which looks at words rather than characters.

Kristine
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.