We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Word limit plus generating bad html (also non xhtml compliant)

Development and Programming

eduqate's avatar
eduqate
53 posts
16 years ago
eduqate's avatar eduqate

I am using word limit plus to show abstracts of stories with links to the full version. The generated page fails validation as xhtml.

The offending html extract (with strategic new lines) is:

This is a fairly boring news story with a massive filler appended.
This is a fairly boring news story with 

…<br><br>

<a href="http://localhost/~ed/EECore1.6.7/index.php/site/_News_story/a_dummy_news_story/">Read the full story ...</a>
</div>

Note there is no closing p tag, also for xhtml the two breaks should be written



To my taste the 2 breaks would be omitted so that the “more” text appeared at the end of the text rather than after a blank line with a closing p tag after the closing a tag.

Ed

[Mod Edit: Moved to the Plugins: Discussion and Questions forum]

       
silenz's avatar
silenz
1,648 posts
16 years ago
silenz's avatar silenz

You could give TruncHTML a try. It’s at least HTML-aware.

       
Robin Sowell's avatar
Robin Sowell
13,160 posts
16 years ago
Robin Sowell's avatar Robin Sowell

I’d suggest TruncHTML as well. The simple word and character limiters are not designed to check for mark up. The other alternative is to strip the markup before cutting it- and add p tags back around the result.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.