View Full Version : ckeditor get textarea value
05-25-2011, 05:28 PM
Hi i used fckeditor for my textarea for my internal email and i just upgraded to ckeditor
in fckeditor i got the value of textarea (in the db)for the reply email this way
$oFCKeditor->Value = "\n\n\n>>Previous:\n$sql_array->msg_text";
now in ckeditor i tried several ways listed below and cannot get the value.
$CKEditor->value = "HELLO THERE"; // hard coded to test
$CKEditor->config['value'] = "hello there";
$CKEditor->Value = "hello there";
//with array val to test
$CKEditor->value = "\n\n\n>>Previous:\n$sql_array->msg_text";
$CKEditor->Value = "\n\n\n>>Previous:\n$sql_array->msg_text";
$CKEditor->config['value'] = "\n\n\n>>Previous:\n$sql_array->msg_text";
here is the whole thing just so you can see it
$CKEditor = new CKEditor('txtMessage');
$CKEditor->basePath = '/ckeditor/';
$CKEditor->value = "\n\n\n>>Previous:\n$sql_array->msg_text"; // not loading
$CKEditor->config['width'] = 510;
$CKEditor->config['height'] = 400;
Any ideas how to grab the value from the db and set it for the value attribute of my textarea?
05-25-2011, 09:04 PM
05-25-2011, 09:19 PM
This is what i used:
// Create class instance.
$CKEditor = new CKEditor();
$CKEditor->basePath = 'main/classes/ckeditor/';
$CKEditor->editor($Name, $Value);//NAme of the text area and value of it.
05-25-2011, 09:50 PM
Not sure if its a full interface but it has a ckeditor.php that you can include to integrate it and you can add your special php stuff in there if you need to.
Thank you so much, now that i see it, it make perfect sense, i had the name set all i needed to do in that same line was set the value, makes sense now, so simple it illuded me lol.
The only change was that i put it in double quotes, works perfect.
I had the old ancient version and this all started because i was trying to do a custom menu, which in the old version (following the instructions) i never could get to work. So i decided to update, and although the new ckeditor is almost a complete rewrite and initially strange to figure out, i love it now. To get your custom menu you just put your custom menu inside the config js file which is soley designed to overwrite the default config settings, you put it in there and whalla it works perfect.
I also like some of the other features such as it tells you what html lable your using on the bottom of your textarea ie bold, italic, blockquote whatever so you know the block your in. I like much of the new features, alot cleaner and although the documentation and support is somewhat lacking and confusing at times, i am so glad i upgraded.
Again thanks so much for your help, appreciate that. :thumbsup::thumbsup:
05-26-2011, 12:52 AM
Ok let me ask this, i dont expect the code i just want to know the way to think of this and the avenue to go down.
if i want to do this in ckeditor
<textarea name="txtMessage" id="txtMessage" cols="60" rows="15" onKeyDown="limitTextarea(this.form.txtMessage,this.form.countdowntext,800);" OnKeyUp="limitTextarea(this.form.txtMessage,this.form.countdowntext,800);"></textarea>
do i need to make the onkeydown part function and just call the function in my editor?
or do i just make a new ckeditor class and say like editor onKeyDown = whatever
which way to go here? I know the syntax is not right im just asking whick path to follow in your opinion.
Update: lmao i totally forgot they have a textarea option to include. i can use that instead of the class option
like this for starters but i can adapt it.
<textarea class="ckeditor" name="txtMessage" rows="15" cols="55"></textarea>
i think this will work just fine. silly me lmao
05-26-2011, 01:23 AM
It comes with a PHP script that is used to easily generate the editor HTML/JS, so you can use ~3 lines to add the editor instead of copying in everything and setting paths, etc.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.