in reply to Substringing HTML content

While it's messy as hell, as an interim solution, write a subroutine that goes though it character by character which records the following things:

total characters so far
if you are in a tag (i.e. started with a <)
what the last character was
how many tags you are in
how many open tags there are (img could be problematic with this. ditto on any other atomic tags. xhtml would be easier)
what the open tags are and what order they are in

from that you should be able to run through the characters, taking note of all the tags that you'll need to close at the end.

not fun, and hopefully theres a better solution.

Replies are listed 'Best First'.
Re^2: Substringing HTML content
by eternius (Beadle) on Jan 07, 2005 at 20:41 UTC
    thanks :)
    ah crap, I got rid of the whole idea
    I now use a div width a fixed height and overflow:hidden.

    have a good day