Clean up designmode....

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mr.morton
Forum Newbie
Posts: 5
Joined: Wed May 10, 2006 8:52 am

Clean up designmode....

Post by mr.morton »

Hi'


I use a WYSIWYG editor for a textarea and it works pretty but the HTML it makes i can't use
An example of what it produces:
<span style="font-weight: bold;"> Bold <span style="font-style: italic;">test <span style="text-decoration: underline;">test</span></span><br /></span>

But i would really like it to have this format instead:
<b> Bold <i>test <u>test</u></i><br /></b>

Does anybody know how to parse it in PHP to fix this?

Kind regards
Morten
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

regex and/or string parsing with some special nesting support tucked in. It's not fun.
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Post by Benjamin »

Most of the tags you want to use are depreciated. I would encourage you to find another solution.
mr.morton
Forum Newbie
Posts: 5
Joined: Wed May 10, 2006 8:52 am

well......

Post by mr.morton »

The thing is the text entered in the editor will be displayed via flash, and it has a limited HTML support:
http://livedocs.macromedia.com/flash/mx ... 01040.html

Therefor I need the "old" tags.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

Better might be to find all the unique styles (i.e. style="...") and build a stylesheet. Then replace all the style="..." properties with the appropriate class="stylexx" property.
(#10850)
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Re: well......

Post by RobertGonzalez »

mr.morton wrote:The thing is the text entered in the editor will be displayed via flash, and it has a limited HTML support:
http://livedocs.macromedia.com/flash/mx ... 01040.html

Therefor I need the "old" tags.
If the HTML support is limited now, imagine how bad it will be when the <b>, <i> and <u> tags are no longer supported at all? That is the direction of the HTML standard. In fact, <b> and <i> (or is it <u>) are already depricated. The recommendations are to use either <strong>, <em> or <span style="text-decoration: underline;">, I believe.
Post Reply