Month: December 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 🙂

Update query in symfony

Suppose you want to execute query like
UPDATE tableName SET column1 = ‘abc’,column2 = ‘xyz’ WHERE column =’1′;
then you can use the below syntax to do so 🙂

—————————————————————————-

$con = Propel::getConnection();

/* Here you have to set the condition for which you need to update */
$c1 = new Criteria();
$c1->add(TableNamePeer::COLUMN_NAME, $conditionForColumn1);

/* Here you have to set the column value */
$c2 = new Criteria();
$c2->add(TableNamePeer::COLUMN_TO_UPDATE, $value);

BasePeer::doUpdate($c1, $c2, $con);