Anything can be used, I was using that as an example.  The information in
the database contains html elements that were passed through a form.  For
example a user would type in <b>some</b> and then the mysql field would
contain <b>some</b>.

-----Original Message-----
From: John Holmes [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 25, 2004 2:42 PM
To: Erik Meyer; Php-General
Subject: Re: [PHP] summarized results w/function


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