Development

HowToUseFCKeditor

You must first sign up to be able to contribute.

First you have to download the fck-sources (http://www.fckeditor.net/download). Extract all to /web/js/ directory.
To use the editor in symfony, edit /<name of app>/config/settings.yml

  .settings:
    rich_text_fck_js_dir: js/fckeditor

File upload

You have to edit /web/js/fckeditor/fckconfig.js

var _FileBrowserLanguage	= 'php' ;	// asp | aspx | cfm | lasso | perl | php | py
var _QuickUploadLanguage	= 'php' ;	// asp | aspx | cfm | lasso | php

These two vars have to be 'php'.

In newer versions of FCKEditor you also have to enable the PHP connector in file /web/js/fckeditor/editor/filemanager/connectors/php/config.php on line 28, and also set your upload directory (on line 32).

$Config['Enabled'] = false;
$Config['UserFilesPath'] = '/uploads/assets/' ;

and the same do in file js/fckeditor/editor/filemanager/upload/php/config.php

If you choose an another directory, be sure to have write permission for apache user on it.

Generator setting

To use FCK Editor, you must use "fck" instead of rich. For example:

    edit:
      fields:
        desc:         { params: rich=fck size=90x30 config=myfckconfig }

Usage with textarea_tag helper

$options = array(
	'rich' => 'fck',
	'height' => 500,
	'width'	=> 500,
);
echo textarea_tag('inputname', 'Lorem ipsum', $options ); 

Custom settings recommandation

As is seen in previous example, you can set your own configuration file. It is probably good idea to copy fckconfig.js somewhere alse, rename it, modify it to your needs and use it. This way, you can upgrade (replace all files) in fckeditor directory and still have your configuration in a safe place.

FCKeditor 2.5.x Resources Browser configuration

The Resources Browser of FCKeditor 2.5 is in the normal configuration not working. Take the following steps to solve this problem:

1. Make the following changes in the config.php (web/js/fckeditor/editor/filemanager/connectors/php):

// Old code: $Config['Enabled'] = false ;
$Config['Enabled'] = true ;

// Old code: $Config['UserFilesPath'] = '/userfiles/' ;
$Config['UserFilesPath'] = DIRECTORY_SEPARATOR . 'userfiles' . DIRECTORY_SEPARATOR ;

// Old code: $Config['UserFilesAbsolutePath'] = '' ;
$Config['UserFilesAbsolutePath'] = $_SERVER[DOCUMENT_ROOT] . $Config['UserFilesPath'] ;

// Old code: $Config['QuickUploadPath']['File']  = $Config['UserFilesPath'] ;
// Old code: $Config['QuickUploadAbsolutePath']['File']= $Config['UserFilesAbsolutePath'] ;
$Config['QuickUploadPath']['File']   = $Config['FileTypesPath']['File'] ;
$Config['QuickUploadAbsolutePath']['File']  = $Config['FileTypesAbsolutePath']['File'] ;   

// Old code: $Config['QuickUploadPath']['Image']  = $Config['UserFilesPath'] ;
// Old code: $Config['QuickUploadAbsolutePath']['Image']= $Config['UserFilesAbsolutePath'] ;
$Config['QuickUploadPath']['Image']   = $Config['FileTypesPath']['Image'] ;
$Config['QuickUploadAbsolutePath']['Image']  = $Config['FileTypesAbsolutePath']['Image'] ;  

// Old code: $Config['QuickUploadPath']['Flash']  = $Config['UserFilesPath'] ;
// Old code: $Config['QuickUploadAbsolutePath']['Flash']= $Config['UserFilesAbsolutePath'] ;
$Config['QuickUploadPath']['Flash']   = $Config['FileTypesPath']['Flash'] ;
$Config['QuickUploadAbsolutePath']['Flash']  = $Config['FileTypesAbsolutePath']['Flash'] ;  

// Old code: $Config['QuickUploadPath']['Media']  = $Config['UserFilesPath'] ;
// Old code: $Config['QuickUploadAbsolutePath']['Media']= $Config['UserFilesAbsolutePath'] ;
$Config['QuickUploadPath']['Media']   = $Config['FileTypesPath']['Media'] ;
$Config['QuickUploadAbsolutePath']['Media']  = $Config['FileTypesAbsolutePath']['Media'] ; 

2. An extra addition that should be made to the file is the insertion of security logic around the statement

$Config['Enabled'] = true ;

to ensure that only authenticated users with a certain role are able to upload etc.

3. Additional steps needed:
a. create directory userfiles in the document-root
b. create sub-directory file in directory userfiles
c. create sub-directory image in directory userfiles
d. create sub-directory flash in directory userfiles
e. create sub-directory media in directory userfiles
f. chmod the directories to 0777
g. optional: chown the directories with an appropriate user and group

Attachments