Jump to content


Photo

WYSIWYG Editor?


  • Please log in to reply
7 replies to this topic

#1 Mutley

Mutley
  • Members
  • PipPipPip
  • Advanced Member
  • 765 posts

Posted 03 October 2006 - 05:36 PM

At the moment I input my text through a normal TEXT field in a form to the database.

How can I make this a WYSIWYG editor? I've looked but it seems you have to buy everyone, I would like to learn or get source code for free. All I would want to do is Bold/Italic/Underline and colour.
~ Mutley.

#2 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 03 October 2006 - 05:40 PM

anything out there can be built.  So build it, I would start with a text area field.
Then you can try adding some stuff, like an interface to read, and perform the bold, italics functions.
I would have to do a lot of thinking to come up with programming ideas bhind it, but that's all I can say, if I think of anything else I will let you nkow

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#3 Mutley

Mutley
  • Members
  • PipPipPip
  • Advanced Member
  • 765 posts

Posted 03 October 2006 - 05:45 PM

Would I need to use javascript to make it visually appear when I make text bold?
~ Mutley.

#4 mwmobley

mwmobley
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 03 October 2006 - 05:48 PM

Take a look at tinyMCE, it might work for what you need....

http://tinymce.moxiecode.com/

I am currently using it but, its not w/out its own issues.....

mike

#5 Mutley

Mutley
  • Members
  • PipPipPip
  • Advanced Member
  • 765 posts

Posted 03 October 2006 - 05:53 PM

Take a look at tinyMCE, it might work for what you need....

http://tinymce.moxiecode.com/

I am currently using it but, its not w/out its own issues.....

mike


Thanks but there are waaaay too many un-needed options which just slows it right down. I'll see what I can do with it though.

EDIT: Nevermind, didn't see all the versions. :D
~ Mutley.

#6 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,015 posts

Posted 03 October 2006 - 06:40 PM

Here's a simple sample
<html>
<head>
<meta name="generator" content="PhpED Version 4.5 (Build 4513)">
<title>wysiwyg sample</title>
<SCRIPT language='javascript'>
       function showText(txt) {
        while (txt.indexOf("[")>0) txt = txt.replace("[", "<");
        while (txt.indexOf("]")>0) txt = txt.replace("]", ">"); 
        while (txt.indexOf("\n")>0) txt = txt.replace("\n", "<br>");
        document.getElementById('wyg').innerHTML = txt; 
       }
</SCRIPT>
</head>
<body>
<FORM>
Input (Use BB tags eg [b]=bold)<br/>
<textarea name="wysi" rows="10" cols="40" onkeyup="showText(this.value)"></textarea>
</FORM>
Preview
<DIV id='wyg' style='width:400; height: 200; border: 1px solid silver'></DIV>
</body>
</html>

If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts

#7 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 03 October 2006 - 06:47 PM

I personally like TinyMCE that mwmobley suggested.

I found another this directory on Google: http://www.htmlarea.com/
It might help you to find one you like.

An alternative is of course to code your own.

#8 Mutley

Mutley
  • Members
  • PipPipPip
  • Advanced Member
  • 765 posts

Posted 03 October 2006 - 07:16 PM

I've gone with TinyMCE, it's really impressive once you know how to alter the elements. Thanks for the code snippet Barand.
~ Mutley.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users