You are here: Re: [PHP] Trimming Text « PHP « IT news, forums, messages
Re: [PHP] Trimming Text

Posted by Andrι Medeiros on 10/29/88 11:21

On Fri, 2005-07-15 at 16:03 +0100, Richard Davey wrote:
> Hello AndrΓ©,
>
> Friday, July 15, 2005, 4:24:23 PM, you wrote:
>
> AM> I am trying to trim some text containing HTML tags. What I want to
> AM> do is to trim the text without trimming the tags or html entities
> AM> like   and such, wich completelly break the design.
>
> The problem as I see it, is that while it's easy to trim some text and
> then check to see if you were inside an HTML tag or not, it becomes
> MUCH harder to check if you were inside nested tags (for example
> <strong><em>)
>
> If there are no nested tags then it's much easier.. just trim the
> string at X characters and then search for the last occurrence of a
> '>' and the last occurance of '<' - if the first is LESS than the second
> value, then you're in the middle of a tag.
>
> This of course doesn't handle nested tags.
>
> Best regards,
>
> Richard Davey
> --
> http://www.launchcode.co.uk - PHP Development Services
> "I do not fear computers. I fear the lack of them." - Isaac Asimov
>

Yeah... that's the point :( Nested tags are very possible.

I am not sure how one would go here tho

 

Navigation:

[Reply to this message]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация