Re: Limiting HTML char count code with php.

From: Sims (siminfrance_at_hotmail.com)
Date: 04/14/04


Date: Wed, 14 Apr 2004 12:05:18 +0100


> >
> >How could the above be achieved?
>
> In essence: Pick out the bit between the single quotes and check it's
> length.

Sorry I am not sure I follow what you are saying.
I want the output text length to be limited not the tags.

>
> All the stuff you need is at:
>
> http://www.php.net/manual/en/ref.strings.php
> (see explode, strlen)
>
> BTW what are you planning doing it it's too long?

Well if I can limit the number of characters it is easier to display.
for example if I do not want a table to have more than 50 chars then I could
truncate them, but I only want to truncate characters that will be
displayed.
not the html tags that are not displayed.

In my example given I want to limit to 10 the number of characters
displayed,
but not the tags should be excluded.

$text = "<a href='somelonnnnnnngg'>this is a </a>";
                                                             ^^ only 10
chars

>
> --
> Five Cats

Sims