How to integrate Baidu UE under PHP (Ueditor 1.4.3)

Source: Internet
Author: User
Tags php tutorial
How to integrate Baidu UE under PHP (Ueditor 1.4.3)

Recently many blogs have asked me how to integrate Baidu UE (Ueditor 1.4.3), really answer to come, so in this write about the integration of the idea of the Baidu UE, this article uses the latest version of the UE1.4.3.

Download installation

1. First download the latest version of UE1.4.3 on the official website.

UE Official Download Address: Http://ueditor.baidu.com/website/download.html#ueditor

I downloaded the 1.4.3PHP version here. Download the version you are using on the line.

Unzip the file to your project

2. Deploy. Introduce the JS file required by your UE to the front-end HTML page and instantiate it using Geteditor

<Body> 
   
  <ScriptID= "Container"name= "Content"type= "Text/plain">here to write your initialization content
  Script> 
    
  <Scripttype= "Text/javascript"src= "Ueditor.config.js"> 
     Script >     < script type = "Text/javascript" src = "  
      
    Ueditor.all.js "> 
      script>  <  
       
     Script  type= "Text/javascript"> var  ue  = ue.geteditor ('container');  
       script>  
        body>  
     

Browse your page, which is visible ueditor. is not very simple to say.

Configure Ueditor

Ueditor's configuration items fall into two categories: front-end configuration items and back-end configuration items.

The configuration of the front and back ends is written in the backend (Php version config in Php/config.json), and when the editor is instantiated, asynchronously reads the backend configuration information, overwriting it in the configuration of the front-end.

Backend Gets the configuration item > instantiates the configuration entry for the incoming configuration item > ueditor.config.js file

Front-end Configuration items: The official provides two configuration methods, static configuration, dynamic configuration.

Static configuration: That is, configure ueditor.config.js specific configuration items in the Ueditor directory for reference http://fex-team.github.io/ueditor/#start-config

Dynamic configuration: That is, when the UE is instantiated, through the dynamic incoming configuration parameters.

var ue = ue.geteditor (' container '// Write your custom configuration entry here toolbars: [        [' Fullscreen ', ' source ', ' undo ', ' Redo ', ' bold ']    ],    true,    True  });

Back-end Configuration items:

Here is the UE request FIRST: The UE all the operation is to request ServerURL Pass the value of the action variable to do the next step. Get the configuration, upload pictures, get pictures, and more.

The UE default is to get back-end configuration items by reading the ServerURL parameter in Ueditor.config.js in the directory and passing the Action=config through the Get method. The default request is: Serverurl?action=config to get the configuration item. ServerURL can be dynamically configured and Ueditor.config.js static configuration on the front page.

You can test the path under your website Ueditor/php/controller.php?action=config the back-end configuration of the JSON format (other formats are also available, see Official documents) in the following format. If this request error, 400, 500 and other errors, the editor upload related features will not work properly.

"ImageUrl": "Http://localhost/ueditor/php/controller.php?action=uploadimage""ImagePath": "/ueditor/php/ "Imagefieldname": "Upfile""imagemaxsize": 2048"imageallowfiles": [". png", ". jpg", ". JPEG ",". gif ",". bmp "" other configuration items ... ":" Other configuration values ... " }

Integration

As I've said before, all of your UE's operations are done by getting the value of the action variable requested by the ServerURL to do the next step. Get the configuration, upload pictures, get pictures, and more . Understand this, for the integration of PHP. or other languages are very simple. The specific code can refer to the demo provided by the official.

The above describes how to integrate the PHP under the Baidu UE (Ueditor 1.4.3), including the content of the Baidu UE, I hope that the PHP tutorial interested in a friend helpful.

  • 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.