Replace the Default PHPCMS CKEditor with KindEditor

         Recently while studying phpcms, I found the default editor not very user-friendly. I personally don’t prefer CKEditor; I like the domestic lightweight KindEditor more. After researching, I decided to replace it. Tested successfully with local UTF-8, GBK not tested. Anyone interested can give it a try – the method is the same!

Let me show the effect! 

Replace the default PHPCMS CKEditor with KindEditor

 

Here are the specific steps:

First, download a new editor from the KindEditor official website, extract it, and rename the entire folder tokindeditor, then copy it to/statics/js/ directory;

Then modify/phpcms/libs/classes/form.class.php

Search for

  1. if(!defined('EDITOR_INIT')) {

If you haven’t modified this file before, it’s on line 18.

  Replace

<script type="text/javascript" src="'.JS_PATH.'ckeditor/ckeditor.js"></script>'; define('EDITOR_INIT', 1);

with

 

  1. $str .= '<script charset=”utf-8″ type=”text/javascript” src=”'.JS_PATH.'kindeditor/kindeditor-min.js”></script>';
  2. $str .= '<script charset=”utf-8″ type=”text/javascript” src=”'.JS_PATH.'kindeditor/lang/zh_CN.js”></script>';
  3. define('EDITOR_INIT', 1);
  4. $str .= "<script type=/”text/javascript/”>/r/n”;
  5. $str .= “KindEditor.ready(function(K) {/r/n”;
  6. $str .= “editor = K.create('textarea[id=/”$textareaid/”]', {/r/n”;
  7. $str .= “allowFileManager : true,/r/n”;
  8. $str .= “width : '99%',”;
  9. $str .= “height : '400px'”;
  10. $str .= “});”;
  11. $str .= “});”;
  12. $str .= '</script>';

 

,,,KindEditor,,,!

/statics/js/kindeditor/php/file_manager_json.php

  1. //,, /var/www/attached/
  2. $root_path = $php_path . '../attached/';
  3. //URL,, http://www.yoursite.com/attached/
  4. $root_url = $php_url . '../attached/';

phpcms

  1. //,, /var/www/attached/
  2. $root_path = $php_path . '../../../../uploadfile/';
  3. //URL,, http://www.yoursite.com/attached/
  4. $root_url = $php_url . '../../../../uploadfile/';

/statics/js/kindeditor/php/upload_json.php

  1. //
  2. $save_path = $php_path . '../attached/';
  3. //URL
  4. $save_url = $php_url . '../attached/';
  5. //

 

  1. //
  2. $save_path = $php_path . '../../../../uploadfile/';
  3. //URL
  4. $save_url = $php_url . '../../../../uploadfile/';
  5. //

,,!!

/statics/css/zh-cn-system.css:

  1. .addContent{width:960px; margin:0 auto; overflow:hidden;}

  1. .addContent{width:99%; margin:0 auto; overflow:hidden;}

,,,,!

KindEditor,,

kindsoftSyntaxHighlighter

Tutorial

 

,,,,,,!!!

,,,!

 

2013-01-09:

 

2013-01-09 ,“”“”,,!!:

  1. href="/statics/js/kindeditor/plugins/runCode/runCode.css" rel="stylesheet" type="text/css" />
<script language=“javascript” type=“text/javascript” src=“/statics/js/kindeditor/plugins/runCode/zztuku_runCode.js”></script>
http://www.zztuku.com/Html/PHPcms/20121218_5127.html

Leave a Comment

Your email address will not be published.