CodeIgniter Forums
How do I make a text editor like TinyMCE Work with a Database? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: How do I make a text editor like TinyMCE Work with a Database? (/showthread.php?tid=25708)



How do I make a text editor like TinyMCE Work with a Database? - El Forum - 12-21-2009

[eluser]Alfredor[/eluser]
How Am I Supposed to edit text that is located in a database from a text editor like TinyMCE
Just asking? :]


How do I make a text editor like TinyMCE Work with a Database? - El Forum - 12-21-2009

[eluser]BrianDHall[/eluser]
Step 1- get text from database.
Step 2- echo it out as content in the TinyMCE textarea of your form.
Step 3- receive submitted content, clean it, and store it back in database.


How do I make a text editor like TinyMCE Work with a Database? - El Forum - 12-21-2009

[eluser]Alfredor[/eluser]
Okay lets see if I can do it :]

Code:
$this->db->get('content');//for the sake of simpleness

//view file.
[TinyMCE Text Area] echo $content //I know how to put it there...
now what? >_<


How do I make a text editor like TinyMCE Work with a Database? - El Forum - 12-21-2009

[eluser]ecsyle31[/eluser]
What do you mean now what?


How do I make a text editor like TinyMCE Work with a Database? - El Forum - 12-21-2009

[eluser]Alfredor[/eluser]
How I'm I supposed to enter the modified text into the database? Sad


How do I make a text editor like TinyMCE Work with a Database? - El Forum - 12-21-2009

[eluser]dchuk[/eluser]
I don't have any experience with TinyMCE but doesn't it just extend a standard Form textarea? If it does, then just process the form like you would any other standard form on your site.


How do I make a text editor like TinyMCE Work with a Database? - El Forum - 12-21-2009

[eluser]Alfredor[/eluser]
You mean changing the action to a mysql insert function? (Update in this case)


How do I make a text editor like TinyMCE Work with a Database? - El Forum - 12-21-2009

[eluser]dchuk[/eluser]
[quote author="Alfredor" date="1261459453"]You mean changing the action to a mysql insert function? (Update in this case)[/quote]

The action should be a controller action that will call an "update" function in a model to process all the posted data and update your database.

Try watching this and applying the concepts in it to what you are doing:

CRUD Screencast


How do I make a text editor like TinyMCE Work with a Database? - El Forum - 12-21-2009

[eluser]Alfredor[/eluser]
Interesting SC, I'm watching anyways, does anyone wonders why is the PECL website not working? ._. Its weird.


How do I make a text editor like TinyMCE Work with a Database? - El Forum - 12-27-2009

[eluser]Alfredor[/eluser]
Hey everyone!, I got it working wonderfully here is an screenshot.
ScreenShot