Re: summarized results w/function
| From: | John Holmes | Date: | Wed, 25 Aug 2004 19:42:06 +0000 |
| Subject: | Re: summarized results w/function | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-194720@lists.php.net to get a copy of this message | ||
From: "Erik Meyer" <emeyer@ebaseweb.com>
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...}