From: "Erik Meyer" <[EMAIL PROTECTED]>

Here is function

function shorten_news_results ($input_text, $ending_text) {
$news_strip=str_word_count($input_text, 1);
$news_split=array_splice($news_strip, 0, 40);
$news_split[]=$ending_text;
$news_story=implode(' ', $news_split);
echo "$news_story";
           }

Trying to split a string down the middle and not break up any kind of HTML that's present is difficult without looping through each character and keeping track of whether you're in an HTML element or not.


Your original messages says <b> can be used. Is that the only tag? Is it a limited set of HTML or can anything be in the text?

---John Holmes...

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



Reply via email to