CKEDITOR in PHP/TPL Block

Discussion in 'Subrion CMS Plugins Discussion' started by aliv88, Mar 30, 2018.

  1. aliv88

    aliv88 New Member

    Hi,

    I'm using a tpl block with a form and I'd like to use the ckeditor to show the users' input in the what-you-see-is-what-you-get appearance with the toolbar and such so they user can format their document.

    What I'm hoping for is similar to what shows when editing an html block with the ckeditor in /admin/blocks/

    I've added {ia_print_js files="ckeditor/ckeditor"} at the top of the TPL file that I'm using but when I use :

    {ia_add_js}
    CKEDITOR.replace('outline_topics_covered', {extraPlugins: 'autogrow,liststyle', autoGrow_maxHeight: 501, removePlugins: 'resize'});
    {/ia_add_js}

    I am getting an Uncaught ReferenceError: CKEDITOR is not defined
  2. Dayir_A.

    Dayir_A. Staff Member

    Hi @aliv88,

    Try to view the page source... Whether CKEDITOR is really not loaded or it loaded after the CKEDITOR.replace... code.
    The path to the script could be wrong. In this way you'll see an error in the browser's console
  3. aliv88

    aliv88 New Member

    Hello, thank you.

    The path was correct for ckeditor but I could not seem to use it via Javascript. I managed to get it to work using smarty + inserting an assigned php variable like this:

    {ia_wysiwyg value=$value name='name' id='id' toolbar='Simple'}

    It does seem that changing the value for toolbar here does not actually change the toolbar though, it seems to always show the 'Simple' toolbar configuration no matter what this value is..
  4. Dayir_A.

    Dayir_A. Staff Member

    Hi @aliv88,

    toolbar argument can be one of these:
    'simple', 'dashboard', 'extended'

    Thanks.

Share This Page