hi list, having search and not found anything useful I was wondering if anyone here had a decent routine for doing the following: given a relatively long text containing html I need to generate an 'intro' version of this string containing a given number of display characters (e.g. 256) that still contains the relevant valid html ... basically I'm looking for something that does content truncation but takes into account possible html and htmlentities that may be part of the content. an example (chances are what I'm asking is not wholly clear): original string: "<b>HELLO</b>, my name is charlie brown<i>!</i> & I'm a little odd."; shorten text (32 'letters' required): "My name is <b>charlie brown</b><i>!</i> & I'm "; the 32 'letter' length should therefore ignore the B and I tags and treat the & as a single letter ... additionally when truncation occurs with a set of html tags the resulting string should have all the open html tags properly closed. this is not as simple as it may first seem, I could probably do it but I foresee it taking quite some time (which I don't have ... let's all sing 'deadline' together shall we ;-)), in the past I have attempted such a routine but always ended up doing something much simpler (using strip_tags(), etc) due to time constraints. I figure I'm not the only one who has had the requirement to do sensible truncation of html content, and I'm hoping someone might have a routine or know where I can find one. apologies if I have not been searching well enough - part of my problem is likely to be that I don't really know what search terms to use :-/ anyway if anyone has any solid code or know of any I'd be very grateful. kind regards, Jochem -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php