Subject: CKEditor on custom registration

Posted on: 20/03/15 10:05am
By: alb3rt

I'm using a custom registration with Geeklog 2.1.0 and CKeditor, I want to use advanced editor (ckeditor) in one field. Any ideas?

Thanks.




Re: CKEditor on custom registration

Posted on: 20/03/15 12:40pm
By: Laugh

For an example take a look at the commentform_advanced.thtml template file.

Depending on what you do you should wrap it with:

PHP Formatted Code

{noscript}
<div id="advanced_editor" style="display:none;">
...
</div>
 


The main part of the code you want to look at iis:

PHP Formatted Code

          <dt><label for="comment_text">{lang_comment}</label></dt>
          <dd>
            <div id="text_editor" style="display: {show_texteditor};">
              <textarea cols="90" rows="10" name="comment" id="comment_text">{comment}</textarea>
            </div>
            <div id="html_editor" style="display: {show_htmleditor};">
              <textarea cols="90" rows="10" name="comment_html" id="comment_html">{comment}</textarea>
            </div>
          </dd>
          <dd class="description">{allowed_html}</dd>
   
          <dt><label for="commentform-postmode">{lang_postmode}</label></dt>
          <dd>
            <select id="sel_editmode" name="postmode" onchange="change_editmode(this);">
              {postmode_options}
            </select>
          </dd>
 


I included the postmode slection as well which allows the user to switch between the editor and just text.

Then you have to take a look at lib-comment.php:

PHP Formatted Code

            $comment_template = COM_newTemplate($_CONF['path_layout'] . 'comment');
            if ($_CONF['advanced_editor'] && $_USER['advanced_editor']) {
                $comment_template->set_file('form', 'commentform_advanced.thtml');
               
                if (COM_isAnonUser()) {
                    $link_message = "";
                } else {
                    $link_message = $LANG01[138];    
                }
                $comment_template->set_var('noscript', COM_getNoScript(false, '', $link_message));
               
                // Setup Advanced Editor
                COM_setupAdvancedEditor('/javascript/submitcomment_adveditor.js', $permission);

            } else {
                $comment_template->set_file('form', 'commentform.thtml');
            }
 


To see where you need to add in the javascript, etc... This code is designed to be used with any editor that is setup to be used with Geeklog (currently only FCKEditor and CKEditor)

It's not extremely easy to do but this will hopefully point you in the right direction.

Re: CKEditor on custom registration

Posted on: 21/03/15 07:46am
By: alb3rt

I succeeded

Thanks.

Geeklog - Forum
https://www.geeklog.net/forum/viewtopic.php?showtopic=96008