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";
}
Sorry about that..
-----Original Message-----
From: Erik Meyer [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 25, 2004 1:29 PM
To: Php-General
Subject: [PHP] summarized results
I have a function loosely based on the following tutorial from zend.com.
(http://www.zend.com/zend/tut/tutorial-brogdon2.php)
However, instead of using plain-text I am using results with html tags.
For example, the results may have <b>This</b>is some text that has been
inputted from a form. When I use my function it simply takes this string
and counts the number of words and then stops at a length desired and
returns the text. Now, here is my problem. If I don't call my function it
displays fine, but I have to display the entire result since I do not want
to stop in the middle of a word. If I call my function it displays the
summary correctly if there are no html tags in it. However, if I call my
function and there are html tags then it strips the < > off of the html tag
and displays the text in between the angle brackets.
Here is my function (forgive me if I am taking the wrong way this is my baby
step at php)
If anybody has a better way I would appreciate it,
Thank you,
Erik Meyer
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php