> I'm doing a page where the front page will show "news" 
> stories.  What I'd
> like is if the story is longer than X words/chars/etc, the 
> index page will
> show the first X words, then a link for the full story.
> 
> Does anyone have a good idea on how to split after a certain number of
> words?
> 
> Thanks,
> Wade

Put the story in an array and grab the first x elements?  Say you want 50
words you would do:

$num_of_words = 50;
$story_array = explode(" ", $story, $num_of_words);
$story_preview = implode(" ", array_pop($story));

Assuming all words are seperated by a space.

Dustin


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to