Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Senior Coder
    Join Date
    Nov 2010
    Posts
    1,452
    Thanks
    275
    Thanked 32 Times in 31 Posts

    ckeditor get textarea value

    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

    Code:
    $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.

    Code:
    $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

    Code:
    $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;
    $CKEditor->editor('txtMessage');
    Any ideas how to grab the value from the db and set it for the value attribute of my textarea?
    thanks.

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    Does the new CKEditor have a PHP API? I heard it was all Javascript now.

  • #3
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,474
    Thanks
    63
    Thanked 537 Times in 524 Posts
    This is what i used:

    PHP Code:
    include_once('main/classes/ckeditor/ckeditor.php');

    // Create class instance.
    $CKEditor = new CKEditor();
    $CKEditor->basePath 'main/classes/ckeditor/';
    $CKEditor->editor($Name$Value);//NAme of the text area and value of it. 
    I can't really think of anything to write here now...

  • Users who have thanked tangoforce for this post:

    durangod (05-25-2011)

  • #4
    Senior Coder
    Join Date
    Nov 2010
    Posts
    1,452
    Thanks
    275
    Thanked 32 Times in 31 Posts
    @Fumigator
    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.

    @tangoforce

    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.

    Code:
    $CKEditor->editor('txtMessage',"\n\n\n>>Previous:\n$sql_array->msg_text");
    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.

  • #5
    Senior Coder
    Join Date
    Nov 2010
    Posts
    1,452
    Thanks
    275
    Thanked 32 Times in 31 Posts
    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

    Code:
    <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.


    Code:
    <script type="text/javascript" src="ckeditor/ckeditor.js"></script>
    
    <textarea class="ckeditor" name="txtMessage"  rows="15" cols="55"></textarea>
    i think this will work just fine. silly me lmao
    Last edited by durangod; 05-26-2011 at 01:06 AM.

  • #6
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    Quote Originally Posted by Fumigator View Post
    Does the new CKEditor have a PHP API? I heard it was all Javascript now.
    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.


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •