Day: December 25, 2009

How to use FCKeditor in symfony

1. Download the FCKeditor source from http://ckeditor.com/download

2. Extract the source to /web/js/ directory of your symfony project directory

3. To use the editor in symfony, add (edit if present)the below line //config/settings.yml

.settings:
rich_text_fck_js_dir: js/fckeditor

4. 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

Depending on the technology you are using you have to set the above two parameter

5. 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/’ ;

You can set the UserFilesPath to whatever folder you want to store the uploaded file

6. Now you are ready to use the fck editor in your page

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

Thats All 🙂