Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

rich text?

Status
Not open for further replies.

idtstudios2

Programmer
Aug 12, 2005
35
US
After trying many drop-in comment systems, i finally just buckled down and wrote my own. Everything is working wonderful except for the fact that I would like users to use a bit of code in the text (bold, italics, etc).

Does anyone have any recommendations on how to do this? Are there any drop in functions, libraries, etc?

Thanks,
Andrew
 
I think you can try a TGML system much like this system uses

(minus the "'")

Code:
['b]bold['/b] 
['i]italic['/i] 

etc..

us a function like this
Code:
function TGML($text){
    $text=str_replace("[b]","<strong>",$text);
    $text=str_replace("[/b]","</strong>",$text);
    $text=str_replace("[i]","<em>",$text);
    $text=str_replace("[/i]","</em>",$text);
    return $text;
}
 
thanks for both of your replies. I've decided to use both suggestions actually. I'm going to use the editor but also write a function with some simple options in case people start whining about the editor.

Thanks!
 
FCKEditor caveat:

It is good for basic and simple markup. However, if you are looking for wide compatibility there are substantial issues especially with Safari.
 
Issues? FCKEditor doesn't work with several browsers... but it deprecates gracefully and doesn't break anything should your browser not have full support.

I am particularly interested in any specific issues you are referring to - since I had none that affected my choice to use it.

I tested it across pretty much everything on MacOSX and Windows when I was evaluating it... and was convinced to stop my own development and switch to using this code.

Cheers,
Jeff

[tt]Jeff's Page [/tt][tt]@[/tt][tt] Code Couch
[/tt]

What is Javascript? faq216-6094
 
FCKEditor works inconsistently on different browsers.

For example:
In IE you can create a table and bring up cell properties from a right-click menu. Changes are applied. In Firefox, the changes will only be applied if you previoesly selected some cell content before bringing up the properties dialog. If you don't it just fails and nothing happens.

We had a programmer here work on FCKEditor a substantial number of hours to remove bugs and annoyances. We ended up using it in spite of the problems it has. We get out of the pinch by stating requirements for the use of the product.

The issues have more to do with the inconsistent behaviors of the browsers, so your own development would just run into the same set of problems.

It's safe to use as long as one knows about where it doesn't work.
 
I hear what you are saying now... and understand what you mean. I have to admit to not testing tables to that extent. I think, like you, I may just add a few more sentences to the deliverable documentation for my client to cover this.

Thanks for the heads-up.

Cheers,
Jeff

[tt]Jeff's Page [/tt][tt]@[/tt][tt] Code Couch
[/tt]

What is Javascript? faq216-6094
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top