i have a database that contains hundreds of articles in HTML format. that is to say that the database articles contain all kinds of html tags like <b> and <ul>, etc. Possibly even more complicated stuff. There are hundreds, i haven't read them all.
What i would like to do is display an excerpt of up to 350 characters of these articles. I'm worried about just taking the first 350 characters becaus i might just chop right through the middle of some <table> tag or whatever.
I can think of two general approaches
1) use some kind of html parser so that i only grab paired tags...something that creates a hierarchical data object. this sounds complicated. I'd probably go to the sample code here at phpbuilder.com for this.
2) strip out all the html tags and display whatever's left. this sounds easier but i can imagine i might have ugly display issues.
what say ye? if anybody knows where i could find a good example, i would be quite grateful.