View Full Version : convert styles to html tags

Billy T
11-09-2006, 12:20 PM
Hi all

I'm using a rich text editor ( http://www.kevinroth.com/rte/ ) in a cms I'm working on. It works well but it outputs inline styles which 'I think' won't work in Flash (which is where the text ends up) - could be wrong about this...

So, I'm looking for a way to convert

<span style="color: rgb(255, 0, 0);"> asdfv</span>asdv <span style="font-weight: bold; text-decoration: underline;">asdv</span>


<font color="#ff0000"> asdfv</font> asdv <u><b>asdv</b></u>

Anyone know of a function that will do this for me? Don't mind if its javascript, php or actionscript.

Alternatively, does anybody know of a good rich text editor that works on most browsers and has an option to output old school html tags? Or is there a way to get that first string to work in a flash html textfield?

Thanks in advance

11-09-2006, 12:38 PM
I dont know of any off the top of my head, you might have to write a custom funtion in either javascript, php, or even AS to handle it. Flash wont read the span style. Most of the Rich Text Editors generate HTML that wont work in Flash.

Billy T
11-09-2006, 12:44 PM

oh well...

I have a flash text editor that uses some of josh dura's example hacked together with bits of my own. Its a little buggy but guess it will have to do.

Thanks for the reply

11-09-2006, 12:46 PM
You could hack the RTE to change the output from spans to fonts. Just a matter of wading through lines upon lines of JS.

Billy T
11-10-2006, 12:32 PM
unfortunately the RTE I'm using has compressed code - the original source code costs mullah

you're right though - that would probably be easier than trying to convert the tags after they have been created.

For now though, think I'll stick with the all Flash option - its working ok (just)

Thanks again

PS I often don't get new post notification from as.org...very strange...wonder if it has anything to do with the quick replies?

11-10-2006, 12:45 PM
Have you looked into the FCKeditor. Its the one that I use most of the time.

Billy T
11-10-2006, 12:55 PM
yeah I did a while back but then got side tracked by the other one which seemed to work in more browsers

Just had another look then though and it appears to be exactly what I need - ie uses <font> tags etc

Doesn't work in Safari at all but that's not too big a deal. Will have a good play with it again on Monday

Thanks again

Billy T
12-07-2006, 11:18 AM
OK so I'm still going on this one

I took your advice and went back the fckeditor.

I've inserted it into my application and its working very nicely. Well it was anyway. I then upgraded my Firefox to version 2 (I'm on a mac) and suddenly the fckeditor slowed right down. Its loads fairly quickly and my text appears inside which I can manipulate with the controls but I can't type into it for about 30 seconds. Whats really strange is

a) the fckeditor examples on the homepage run just fine in firefox 2
b) I tried another html editor (tinyMCE) and I get the exact same delay before I can type into it

Its all very strange

I guess it could be something to do with my server but then why would it run fine before I upgraded to firefox v2?

Anyone got any ideas on this one?


Billy T
12-07-2006, 11:29 AM
just a follow up

I redownloaded an old version of firefox (the one before 1.5) and the fckeditor on my site works perfectly on that so it clearly has something to do with v2 of firefox

I've searched around and found no info on this problem