Phpcms default CKEditor editor to Kindeditor tutorial

Source: Internet
Author: User

The following are specific practices:

First, go to kindeditor official website to download a new editor, unpack its entire folder renamed to Kindeditor, upload to \statics\js\ directory;

Then modify the \phpcms\libs\classes\form.class.php
Find

if (!defined (' Editor_init ')) {
Will
$str = ' <script type= ' text/javascript ' src= '. Js_path. ' Ckeditor/ckeditor.js ' ></script> ';d efine (' Editor_init ', 1);
Replaced by
$str. = ' <script charset= ' utf-8 ' type= ' text/javascript ' src= '. Js_path. ' Kindeditor/kindeditor-min.js ' ></script> ';
$str. = ' <script charset= ' utf-8 ' type= ' text/javascript ' src= '. Js_path. ' Kindeditor/lang/zh_cn.js ' ></script> ';
Define (' Editor_init ', 1);
$str. = "<script type=\" text/javascript\ ">\r\n";
$str. = "Kindeditor.ready (function (K) {\ r \ n";
$str. = "editor = k.create (' textarea[id=\" $textareaid \ "] ', {\ r \ n"; $str. = "allowfilemanager:true,\r\n";
$str. = "width: ' 99% ',";
$str. = "Height: ' 400px '"; $str. = "});";
$str. = "});";
$str. = ' </script> ';
Save, refresh, you can see, the editor has been changed to Kindeditor, but the test found that can not upload pictures, accessories and so on!

Here are some changes to make:

Open \statics\js\kindeditor\php\file_manager_json.php
Will:
Root path, you can specify an absolute path, such as/var/www/attached/
$root _path = $php _path. '.. /attached/';
Root URL, you can specify an absolute path, such as http://www.yoursite.com/attached/
$root _url = $php _url. '.. /attached/';
The upload directory modified to Phpcms can be
Root path, you can specify an absolute path, such as/var/www/attached/
$root _path = $php _path. '.. /.. /.. /.. /uploadfile/';
Root URL, you can specify an absolute path, such as http://www.yoursite.com/attached/
$root _url = $php _url. '.. /.. /.. /.. /uploadfile/';
The same will be \statics\js\kindeditor\php\upload_json.php in the
File Save directory path
$save _path = $php _path. '.. /attached/';
File Save Directory URL
$save _url = $php _url. '.. /attached/';
Define file extensions to allow uploads
Modified to:
File Save directory path
$save _path = $php _path. '.. /.. /.. /.. /uploadfile/';
File Save Directory URL
$save _url = $php _url. '.. /.. /.. /.. /uploadfile/';
Define file extensions to allow uploads

The article publishing page to adjust to full screen, personal preferences, irrelevant! No change!

To \statics\css\zh-cn-system.css in the following:

. addcontent{width:960px margin:0 Auto; overflow:hidden;}
Modified to:
. addcontent{width:99% margin:0 Auto; overflow:hidden;}

OK, so far, basically with the use, if what you feel is not beautiful, you can try to make changes!

Idea, the default seventh button is "Insert program code", that is, kindeditor with the code sorghum plug-in, after inserting, the front page template needs to call the following code:

<script type= "Text/javascript" src= "{js_path}kindeditor/plugins/code/prettify.js" ></script>
<link href= "{js_path}kindeditor/plugins/code/prettify.css" rel= "stylesheet" type= "Text/css"/>
The following code is also added to the footer to initialize:
<script>
Prettyprint ();
</script>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.