PHPCMS V9 Integrated Baidu Ueditor method detailed

Source: Internet
Author: User
Tags php editor

About Baidu Rich Text online editor Ueditor powerful function, here do not want to say, if not yet understand, their own Baidu. The next thing I want to do is to replace Phpcms v9 original editor ckeditor with Ueditor.

Phpcms v9 version: Phpcms V9.4.2utf8

Ueditor: Version: ueditor1.2.6.1utf8-php

Here to say, a lot of online on the Phpcms v9 Integration Ueditor review articles, ignoring the version of the problem, resulting in some problems, such as garbled, and even can not be integrated, so here special emphasis, integration should pay attention to the consistency of the version before.


1. Download ueditor1.2.6.1utf8-php Editor from Baidu http://ueditor.baidu.com/website/, download from http://download.phpcms.cn/v9/9.4/phpcms V9.4.2utf8


2. Upload the Ueditor editor to the phpcms default JS file path, upload the file path as follows:

/statics/js/ueditor/


3. Open/phpcms/libs/classes/form.class.php and find the following code:

The code is as follows Copy Code

if (!defined (' Editor_init ')) {

$str = ' <script type= ' text/javascript ' src= '. Js_path. ' Ckeditor/ckeditor.js ' ></script> ';

Define (' Editor_init ', 1);

}

Replace with (that is, the original editor's address and other information are replaced by:

The code is as follows Copy Code


if (!defined (' Editor_init ')) {

$str. = ' <script type= ' text/javascript ' src= '. Js_path. ' Ueditor/ueditor.config.js ' ></script> ';

$str. = ' <script type= ' text/javascript ' src= '. Js_path. ' Ueditor/ueditor.all.js ' ></script> ';

$str. = ' <link rel= ' stylesheet ' href= '. Js_path. ' Ueditor/themes/default/css/ueditor.css '/> ';

$str. = ' <script type= ' text/javascript ' src= '. Js_path. ' Swfupload/swf2ckeditor.js ' ></script> ';

Define (' Editor_init ', 1);

}

$str. = "<script type=/" text/javascript/">/r/n";

$str. = "var editor = new Baidu.editor.ui.Editor (); Editor.render (' $textareaid ');/r/n";

$str. = ' </script> ';


4. Modify the default width and height of the editor, because the PHPCMS default editor is not that large, the specific modification method is:

The code is as follows Copy Code

Locate the following code and remove the previous comment "//":

, initialframewidth:698//Init editor width, default 1000

, initialframeheight:400//init editor height, default 320

That becomes:

, initialframewidth:698//Init editor width, default 1000

, initialframeheight:400//init editor height, default 320

It's done here.

Experience:

1, some articles on the Internet need to modify the ueditor.config.js path such as "window." Ueditor_home_url = "/statics/js/ueditor/"; "I don't think it's necessary."

2, if the integration of good, the test found that the picture upload, such as click Upload Image pop-up as shown in the picture window:

The reason for this is that the site is installed on a subdirectory of the server root directory, which, of course, is the same as above for window. Ueditor_home_url "Whether the setting is not related.

The solution is to install the site at the root of the server.

The original source from: Weblog blog

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.