Re: [PHP] generating an html intro text ...

2007-06-18 Thread Jochem Maas
Stut wrote: > Jochem Maas wrote: >> Stut wrote: >>> I'm sure Tidy could be employed to do this job. Grab your target length >>> of text, backtrack until you find < or >. If it's a < then chop that bit >>> off. Then give it to Tidy to fix the HTML. That should close off any >>> open tags and give yo

Re: [PHP] generating an html intro text ...

2007-06-18 Thread Stut
Jochem Maas wrote: Stut wrote: I'm sure Tidy could be employed to do this job. Grab your target length of text, backtrack until you find < or >. If it's a < then chop that bit off. Then give it to Tidy to fix the HTML. That should close off any open tags and give you a properly formed snippet.

Re: [PHP] generating an html intro text ...

2007-06-18 Thread Jochem Maas
Stut wrote: > Edward Kay wrote: ... >> >> A few thoughts I've had on this problem: >> >> Assuming it is well formed HTML, you could use a stack. Parse the string >> putting all opening tags on the stack and then removing them when the >> close >> tag is found. This will leave you with all the un-

Re: [PHP] generating an html intro text ...

2007-06-18 Thread Stut
Edward Kay wrote: -Original Message- From: Jochem Maas [mailto:[EMAIL PROTECTED] Sent: 18 June 2007 13:18 To: tedd Cc: [php] PHP General List Subject: Re: [PHP] generating an html intro text ... tedd wrote: At 11:39 AM +0200 6/14/07, Jochem Maas wrote: original string: ... The

RE: [PHP] generating an html intro text ...

2007-06-18 Thread Edward Kay
> -Original Message- > From: Jochem Maas [mailto:[EMAIL PROTECTED] > Sent: 18 June 2007 13:18 > To: tedd > Cc: [php] PHP General List > Subject: Re: [PHP] generating an html intro text ... > > > tedd wrote: > > At 11:39 AM +0200 6/14/07, Jochem

Re: [PHP] generating an html intro text ...

2007-06-18 Thread Jochem Maas
tedd wrote: > At 11:39 AM +0200 6/14/07, Jochem Maas wrote: >> original string: >> ... > > The problem as I see it is covering all the possibilities that may occur > even if the text is well formed. Like what if someone introduces a span > that sets a color for a paragraph, such as: > > Dolore m

Re: [PHP] generating an html intro text ...

2007-06-15 Thread tedd
At 11:39 AM +0200 6/14/07, Jochem Maas wrote: original string: "HELLO, my name is charlie brown! & I'm a little odd."; shorten text (32 'letters' required): "My name is charlie brown! & I'm "; the 32 'letter' length should therefore ignore the B and I tags and treat the & as a sin

Re: [PHP] generating an html intro text ...

2007-06-15 Thread Daniel Brown
On 6/15/07, Jochem Maas <[EMAIL PROTECTED]> wrote: Daniel Brown wrote: ... Dan, I don't want to put a downer on things, especially considering the ammount of time/energy you spent writing the code you posted. ... but this is not exactly what I was looking for. I guess my feable attempt at exp

Re: [PHP] generating an html intro text ...

2007-06-15 Thread Jochem Maas
Daniel Brown wrote: ... Dan, I don't want to put a downer on things, especially considering the ammount of time/energy you spent writing the code you posted. ... but this is not exactly what I was looking for. I guess my feable attempt at explaining myself was rather off the mark. I'm looking

Re: [PHP] generating an html intro text ...

2007-06-14 Thread Daniel Brown
On 6/14/07, Edward Vermillion <[EMAIL PROTECTED]> wrote: On Jun 14, 2007, at 4:39 AM, Jochem Maas wrote: > 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

Re: [PHP] generating an html intro text ...

2007-06-14 Thread Edward Vermillion
On Jun 14, 2007, at 4:39 AM, Jochem Maas wrote: 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 g