OakWeb [Reserved] Usage of the online editor Fckeditor in PHP (modified) Chianuinx. Net

xiaoxiao2021-03-06  74

Fckeditor is an open source project on the SourceForge.Net, mainly to implement online web editors, official website is http://www.fckeditor.net, support ASP.NET, ASP, CLODFusion, PHP, Java, etc. in the server side Language and supports mainstream browsers such as IE 5 , Mozilla, Netscape. The latest version is 2.0 Beta 2, but currently 2.0 Beta does not support PHP, so I have selected 1.6 version. First we first go to http://sourceforge.net/projects/fckeditor/ to download fckeditor_1.6.zip and unzip it into your website subdirectory and change the folder name to fckeditor. Go to the fckeditor / directory, open the _Test / Directory, contain a variety of programming language to call the fckeditor method, where the file related to PHP has 2 files: Test.php // Submit the data page TestSubmit.php // Display data You can take a look at it, learn about the calling method of Fckeditord, below I have written a Test program:

Basepath = '../fckeditor/'; // Install the fckeditor $ OFCKEDITOR-> CreateFCKEDITOR ('editordefault', '100%', 300);> From the above example we can see what to use FcKeditor, first perform include ("../ fckeditor / fckeditor.php"); statement to reference fckeditor.

Then execute $ OFCKEDITOR = New fckeditor; $ OFCKEDITOR-> Basepath = '../fckeditor/; $ OFCKEDITOR-> CREATEFCKEDITOR (' EditOrDefault ',' 100%, 300); to instantiate fckeditor if it is the editing page Join one row: // $ Content can be the data from the database $ OFCKEDITOR-> value = $ content; By default, the upload image feature only corresponds to the ASP mode, you want to implement the file under the PHP, Have a modification of the Fckeditor's profile.

Open / fckeditor / js / fck_config.js (this is the main configuration file of FCKEDITOR), positioned to the bottom of the file, the content you are commented out, will // ## // ## Image Browsing // ## config.ImageBrowser = true; // Custom Page URL config.ImageBrowserURL = config.BasePath "filemanager / browse / sample_html / browse.html"; //config.ImageBrowserURL = config.BasePath "filemanager / browse / sample_php / browse. php "; //config.ImageBrowserURL = config.BasePath "? filemanager / browse / sample_jsp / browse.jsp type = img "; //config.ImageBrowserURL = config.BasePath " filemanager / browse / sample_asp / browse.asp " ; // ## // ## Image Upload // ## config.ImageUpload = true; // Page that effectivelly upload the image config.ImageUploadURL = config.BasePath "filemanager / upload / asp / upload.asp".; //config.ImageUploadURL = config.BasePath "filemanager / upload / aspx / upload.aspx"; //config.ImageUploadURL = config.BasePath "filemanager / upload / cfm / upload.cfm"; //config.ImageUploadURL = Config.basepath "filemanager / upload / php / upload.php"; //config.imageuploadURL = config.basepath "Fileman Ager / upload / jsp / upload.jsp .html "; config.ImageBrowserURL = config.BasePath " filemanager / browse / sample_php / browse.php "; // ## // ## Image Upload // ## config.ImageUpload = true; // Page that effectivelly upload The image. config.imageuploadURL = config.basepath "fileManager / upload / php / upload.php"; finally modify 2 files:

Line 22 /FCKeditor/filemanager/upload/php/upload.php $ UPLOAD_BASE_URL = '/ userimages /'; /FCKeditor/filemanager/browse/sample_php/browse.php line 20 $ IMAGES_BASE_URL = '/ FCKeditor / userimages /'; This two define which directory uploads to which you are uploaded, you can define it yourself, but you must make sure that the directory is present, otherwise it will be reported when you upload the image. Then we delete it in the fckeditor directory in the directory. Ok, the basic method of fckeditor tells here. If you are interested, you can go to my website to see the effect: http://www.shaof.com. Supplement: In the official website of the Fckeditor, FcKeditor currently supports 3 browsers: IE5 , Mozilla and Netscape. However, in the experiment, IE 5.0 is not supported by IE5.0, which is only upgraded to 5.5 or 6.0 to support image upload functionality. For the Just Mozilla Firefox 1.0 RC1 and Mozilla 1.6 (Linux Environment), FcKeditor cannot be used at all. The following is a screenshot using IE5.0 and IE6.0. FCKEDITOR screenshot

When you use IE5.0, you can't see the "Upload" prompt.

转载请注明原文地址:https://www.9cbs.com/read-92264.html

New Post(0)