Re: [PHP] Check for well formed html

2007-08-07 Thread Richard Lynch
On Sun, August 5, 2007 6:16 am, tedd wrote:
 I have a client who wants to include html tags in his CMS.

 I know that I can limit what tags he can use, but how can I check if
 the text is well formed with the tags permitted before storing it in
 his CMS?

http://php.net/tidy

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Check for well formed html

2007-08-06 Thread tedd

At 5:14 PM +0200 8/5/07, Tijnema wrote:

On 8/5/07, tedd [EMAIL PROTECTED] wrote:

 Hi gang:

 I have a client who wants to include html tags in his CMS.

 I know that I can limit what tags he can use, but how can I check if
 the text is well formed with the tags permitted before storing it in
 his CMS?

 Cheers,

 tedd



Have a look at Example 1687 on the manual page for preg_match_all, I
think you can use it with a little modification :)

Tijnema


Tijnema:

Thanks, that was interesting. See:

http://www.webbytedd.com/b/match-tags/

The code will find and pull out matched tags, but it produces odd 
results if it finds a malformed tag (i.e., b/ ).


Cheers,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Check for well formed html

2007-08-05 Thread Tijnema
On 8/5/07, tedd [EMAIL PROTECTED] wrote:
 Hi gang:

 I have a client who wants to include html tags in his CMS.

 I know that I can limit what tags he can use, but how can I check if
 the text is well formed with the tags permitted before storing it in
 his CMS?

 Cheers,

 tedd


Have a look at Example 1687 on the manual page for preg_match_all, I
think you can use it with a little modification :)


Tijnema
-- 
Vote for PHP Color Coding in Gmail! - http://gpcc.tijnema.info

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Check for well formed html

2007-08-05 Thread Kathleen Ballard
Tedd,
Finally, I can give you an answer!  :)

You can use html tidy.  I did this before the php tidy function was fully
implemented, so I don't know the syntax for that.  But using tidy from the
command line you can set have it either correct errors (probably not what
you want) or just have it return an error flag and log the errors.

http://www.php.net/manual/en/ref.tidy.php

http://tidy.sourceforge.net/

Kathleen

-Original Message-
From: tedd [mailto:[EMAIL PROTECTED] 
Sent: Sunday, August 05, 2007 7:17 AM
To: php-general@lists.php.net
Subject: [PHP] Check for well formed html

Hi gang:

I have a client who wants to include html tags in his CMS.

I know that I can limit what tags he can use, but how can I check if 
the text is well formed with the tags permitted before storing it in 
his CMS?

Cheers,

tedd

-- 
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php