> Personally when I'm doing teasers I strip all HTML from the content 
> before using substr:
> 
> $teaser = strip_tags($content);
> $teaser = substr($teaser, 0, 100);
> $teaser .= '...';     // Nice touch to have a '...' on the end :)
> 

You don't have a handy way to check that your substr() doesn't cut off
half-way through a word, do you?

I'm up against this issue myself at the moment and it's a PITA to sort out -
I keep getting things like "Fnord fnord fnord fnord fnord fno", where the
last "fnord" is missing its "rd".

It's bound to be a case of stepping back through the string until a space is
encountered, and then keeping everything to the left of that, but I haven't
worked out an elegant way to do it yet :-)


Cheers
Jon


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to