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:
$shortdesc = $_helper-
Can I just give a thought ?
Sample text :
Lorem ipsum dolor sit amet, magna aliquyam erat, duo dolores et ea rebum. Stet clita kasd gubergren hello
First, parse it into:
array(
'0' => array(
'tag' => '',
'text' => 'Lorem ipsum dolor sit amet, '
),
'1' => array(
'tag' => '',
'text' => 'magna aliquyam erat',
)
'2' => ......
'3' => ......
)
then cut the text one by one, and wrap each one with its tag after cut,
then join them.