HTML text extraction

HTML text extraction

am 18.08.2009 10:37:41 von leledumbo

Usually, a website gives preview of its articles by extracting some of the
first characters. This is easy if the article is a pure text, but what if
it's a HTML text? For instance, if I have the full text:


bla bla bla




and I take the first 40 characters, it would result in:


bla bla bla

Re: HTML text extraction

am 18.08.2009 10:41:07 von Ashley Sheridan

On Tue, 2009-08-18 at 01:37 -0700, leledumbo wrote:
> Usually, a website gives preview of its articles by extracting some of the
> first characters. This is easy if the article is a pure text, but what if
> it's a HTML text? For instance, if I have the full text:
>
>


> bla bla bla
>


>


>
> and I take the first 40 characters, it would result in:
>
>


> bla bla bla
>

Re: HTML text extraction

am 18.08.2009 12:10:25 von Richard Heyes

HI,


> ...

The easy way (Back to the Future 2 anyone...?) would be to use
strip_tags() first:

http://uk.php.net/strip_tags

--
Richard Heyes
HTML5 graphing: RGraph - www.rgraph.net (updated 8th August)
Lots of PHP and Javascript code - http://www.phpguru.org

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: HTML text extraction

am 22.08.2009 04:33:54 von Manuel Lemos

Hello,

on 08/18/2009 05:37 AM leledumbo said the following:
> Usually, a website gives preview of its articles by extracting some of the
> first characters. This is easy if the article is a pure text, but what if
> it's a HTML text? For instance, if I have the full text:
>
>


> bla bla bla
>


>


>
> and I take the first 40 characters, it would result in:
>
>


> bla bla bla
>