title: Shorten text without splitting words or breaking html tags
body: <p>I am trying to cut off text after 236 chars without cutting words in half and preserving html tags. This is what I am using right now:</p>
  
  <pre><code>$shortdesc = $_helper-&gt;productAttribute($_product, $_product-&gt;getShortDescription(), 'short_description');
  $lenght = 236;
  echo substr($shortdesc, 0, strrpos(substr($shortdesc, 0, $lenght), " "));
  </code></pre>
  
  <p>While this is working in most cases, it won't respect html tags. So for example this text:</p>
  
  <pre><code>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. &lt;strong&gt;Stet clita kasd gubergren&lt;/strong&gt;
  </code></pre>
  
  <p>will get cut off with the  tag still being open. Is there any way to cut off text after 236 chars but respecting html tags? </p>