Re: Show abbreviated article
| From: | Jason Wong | Date: | Mon, 13 Aug 2001 10:11:32 +0000 |
| Subject: | Re: Show abbreviated article | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-11280@lists.php.net to get a copy of this message | ||
One way to do it is to:
loop through the list of articles;
explode the body of article ==> $words = explode(" ", $body, 21);
$words is now an array of 21 elements, the first 20 elements contain the
first 20 words in the body, the 21st element contains the rest of the body;
--
Jason Wong
Gremlins Associates
www.gremlins.com.hk
>
> On my website I want to display some articles, in Slashdot style. The
> main page should only display the first 20 words of the article, and
> users should be able to click on a link to view the entire article.
> The articles are stored in a MySQL database, the body of the article in a
> blob-field.
>
> My question is this: how can I select only those first 20 words in the
> PHP code?
>
> I hope somebody can help me with this.
>
> Cilfa