|
Posted by Hello on 07/20/05 07:52
There is a function in PHP that strips the HTML tags called "strip_tags"
then when you get the string back with no tags use "substr" or something to
get the first 100 chars.
"Dave Moore" <dave_m_moore@post2me.freeserve.co.uk> wrote in message
news:dbjluv$chk$1@news5.svr.pol.co.uk...
> Hi All,
> Here's my problem. I have a large textual entry in a database which I
> want to extract and display on a webpage using php. Everything's ok, so
> far.
> However, I only want to show the first 100 characters of the text, not all
> of it. The problem is that the text includes HTML tags. If I simply cut
> the
> text off at 100 characters, there's a chance that I will do so in the
> middle
> of a HTML tag which will then break the rest of the page.
>
> So my question is: can I use php to help me detect an appropriate place to
> cut the string?. Is there a neat function to do this or will I have to
> muck
> around with string analysis functions?. Alternatively is there a way to
> render the whole string but only make the first 100 characters visible?.
> Maybe this would be neater?.
>
> Any comments or suggestions gratefully received.
>
> Ta,
> Dave
>
>
>
>
Navigation:
[Reply to this message]
|