Derek,

That looks promising - I'll give it a try.

The other issue I'm trying to solve is more of a browser/client issue.  If a user has typed a message using the HTML editor, and then uses the toggle button to switch to the plain text editor, it would be ideal if this same HTML->Text rendering were performed.  However, the PHP solution is a "back end" solution that would require another trip to the server.

 I see three options:

  1. empty the text field when switching editor types (users will be mad)
  2. re-post the page when switching editor types, so the PHP HTML->Text or Text->HTML can be done on the server (slow and kind of an interruption)
  3. do the conversion in JavaScript in the browser (TinyMCE doesn't do this, so we'd have to find a JavaScript implementation of an HTML->Text renderer)

Any thoughts or other options?  If #2 is the choice, I'd also like to ask for suggestions as to the best way to implement it.

-Eric

 

On Wed, 7 Jun 2006 11:40:38 +0800, "Derek Hinchliffe" wrote:

On 6/6/06, Eric Stadtherr  wrote:
>

>
> Strip the HTML tags using strip_tags() and just leave the text without any formatting.
> Write or integrate an HTML=>text renderer (similar to what would be in a text-only web browser)
> Clear the contents of the text field when switching editor types
>
>
> Any thoughts from the group?
>

From a user point of view (and what is expected from other email
clients) the HTML->Text renderer would be by far the best option. I
looked into this for something else and I found the following GPLed
PHP class that is a good starting point:
http://www.chuggnutt.com/html2text.php

Cheers
Derek