First of all, now the latest version of the FCK package, extracted to tp the third Party Library folder: Vendor
Start configuration FCK:
First, find the FCK root directory fckeditor_php5.php, about 130 lines of __construct, modify FCK path information: $this->basepath = '/thinkphp/vendor/fckeditor/' ;
Second, set editor picture upload directory, find fck:fckeditor/editor/filemanager/connectors/php, about 34 lines set: $Config [' userfilespath '] = ' thinkphp/ Uploadfiles/'; Remember, to create this folder in the root directory, ensure that the user has write permission.
Start calling the FCK editor in the TP template:
For example, in the controller index call, then the controller in the wording:
The Public Function index () {Vendor ("fckeditor.fckeditor");//contains the FCKeditor class library, TP introduces the system method of the third party class library, its path is relative to the vendor directory. $editor = new FCKeditor (); Instantiate the FCKeditor object $editor->width= ' 980 ';//Set the width that the editor actually needs. If this item is omitted, the default width is used. $editor->height= ' 400 ';//Set the height that the editor actually needs. If this is omitted, the default height is used. $this->value= ';//Set editor initial value. It can also be a set value when modifying data. can be empty. $editor->instancename= ' comment '; Enter the ID and name of the tag in the form that contains the label, that is, the ID and name of the <input> label. Here is the false//Set as comment. This is not a province, but also to maintain uniqueness. Once the form is uploaded to the server handler, it can be read by $_post[' comment '. $html = $editor->createhtml ()//creates an online editor HTML code string and assigns value to the string variable $html. $this->assign (' HTML ', $html);//assigns $html values to the template variable $html. You can refer directly to the template through {$html}. D (); $this->display (); }
In the TP Template:
Where you need to invoke the editor: {$html}
Here's an example:
Vendor ("Fckeditor.fckeditor"); $editor = new FCKeditor (' Content '); Instantiate the FCKeditor object $editor->width= ' 98% '; $editor->height= ' 400 '; $this->value= '; $html = $editor->createhtml (); $this->assign (' HTML ', $html);