How can we call ckeditor? The following small series will summarize the methods for calling ckeditor by using php and calling ckeditor by js. The methods for calling other scripts are roughly the same.
PHP calls FCKeditor
Put FCKeditor in the website root directory
The PHP file contains the/FCKeditor/ckeditor/"target =" _ blank "> fckeditor. php file.
Insert the following code where the editor needs to be placed on the webpage to call it:
| The Code is as follows: |
Copy code |
<? Php
// Contains the fckeditor class
Include ("fckeditor/fckeditor. php ");
// Create a FCKeditor with the form name jzleditor
$ OFCKeditor = new FCKeditor ("jzleditor ");
// Set the editor path
$ OFCKeditor-> BasePath = "fckeditor /";
$ OFCKeditor-> ToolbarSet = "Default"; // tool button
$ OFCKeditor-> Value = $ cont; //; set the initial content
$ OFCKeditor-> Width = "100%"; // set its Width.
$ OFCKeditor-> Height = "550px"; // set its Height
$ OFCKeditor-> Create ();
?> |
Input content. After submission, the input content is obtained through $ _ POST ["jzleditor"] in the processed file.
Js calls FCKeditor
CKEDITOR is easy to use. First download CKEDITOR 3.6.1 (PHP version by default), and then write the following two sections of js in the head of the call page:
| The Code is as follows: |
Copy code |
|
<Script type = "text/javascript" src = "ckeditor/ckeditor. js"> </script>
<Script type = "text/javascript"> window. onload = function ()
{
CKEDITOR. replace ("content ");
};
</Script> |
Note: The content here is the name of <textarea>, as shown below:
<Textarea name = "content"> ddd </textarea> for version 3.6.2, this statement may be written as follows:
<Textarea name = "content" class = "ckeditor"> ddd </textarea>
For issues caused by version differences, please pay attention to this issue during runtime.
On the next page, obtain the corresponding value based on the name value content