memberlogin
contactus
randomfacts

Configure fckeditor to work in php

When you are trying to set up the fckeditor to work with php it's relatively easy.  Get the fckeditor files from www.fckeditor.net , and upload it to your a directory in your website.

For uploading images you will need to create a folder named "UserFiles" in the same directory as you placed the fckeditor folder.

Set the permissions on the UserFiles folder to 777.

Now you will need to change the basepath variable to point to the fckeditor folder.

1. [fckeditor folder]/fckeditor.php  = change the line that says $BasePath  =  'whatever' to the absolute path to the fckeditor folder (e.g. $BasePath  =  '/tools/fck/'  ; )

2. [fckeditor folder]/editor/filemanager/browser/default/connectors/php/config.php  = change the line that says $Config['Enabled'] = False to $Config['Enabled'] = True.   AND also change the line that says $Config['UserFilesPath'] = 'whatever' to the absolute path to the UserFiles directory (e.g. $Config['UserFilesPath'] = '/tools/UserFiles/' ; ).

3. [fckeditor folder]/editor/filemanager/upload/php/config.php  = change the line that says $Config['Enabled'] = False to $Config['Enabled'] = True.   AND also change the line that says $Config['UserFilesPath'] = 'whatever' to the absolute path to the UserFiles directory (e.g. $Config['UserFilesPath'] = '/tools/UserFiles/' ; ).

 

Now on the web page that you want to use the fckeditor on you will need to 1st include the main fckeditor.php file we modified in step 1.  (e.g. <? include("fck/fckeditor.php") ; ?>

Then to actually display the fckeditor you will need to add this code:

<?php
   // Automatically calculates the editor base path based on the _samples directory.
   // This is usefull only for these samples. A real application should use something like this:
   // $oFCKeditor->BasePath = '/fckeditor/' ; // '/fckeditor/' is the default value.
   $sBasePath = $_SERVER['PHP_SELF'] ;
   $sBasePath = substr( $sBasePath, 0, strpos( $sBasePath, "_samples" ) ) ;
   
   $oFCKeditor = new FCKeditor('emailbody') ;
   $oFCKeditor->Width  = '100%' ;
   $oFCKeditor->Height = '600' ;
   $oFCKeditor->Value  = $body ;
   $oFCKeditor->Create() ;
  ?>

my form field will be named emailbody

the width is 100%

the height is 600px

the default value to be inside of the editor is the value held in the variable $body

 

In this example I'm using fckeditor version 2.1