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



Relevant Pages

  • Re: Limiting HTML char count code with php.
    ... I want the output text length to be limited not the tags. ... Well if I can limit the number of characters it is easier to display. ... but I only want to truncate characters that will be ...
    (comp.lang.php)
  • Re: [PHP] Newline and tab characters
    ... browser would ignore these characters. ... within a tag in which case I mustn't strip them. ... display you need to strip them once for each request. ... you should somehow avoid replacing within tags. ...
    (php.general)
  • gforth: SDL/OpenGL Graphics Part VIII
    ... There are times when all you need is the simple 8x8 font that we had ... want to use the original PC font text line characters. ... TTFs to the display are too much when you just want to "do it". ... sets the cursor x coordinate. ...
    (comp.lang.forth)
  • Re: Using Kermit-95 to emulate a VT320
    ... as Bill G. pointed out. ... The display of non- ... printable characters is dubious. ... do it the same way so basing a production system on a particular behavior ...
    (comp.os.vms)
  • RE: Debian and Unicode line drawing
    ... I noticed that every frame in default Debian configuration in PuTTY ... installation is set to use Unicode UTF-8 encoded characters so ncurses ... Assuming that you are running PuTTY under Windows, many Windows fonts ... installed font that I could find that would display a hyphen correctly ...
    (Debian-User)