- Create the sfCKEditorPlugin folder in the Plugins folder.
- Download package: http://www.symfony-project.org/plugins/sfCKEditorPlugin
- Go to http://ckeditor.com/ and download the last version.
- Put the ckeditor folder to the web\js folder.
- Go to http://ckfinder.com/ and download the last version.
- Put the ckfinder folder to the web\js folder.
- Add sfCKEditorPlugin to the ProjectConfiguration.class.php
- Open app.yml (apps/frontend or backend/config..) and put:
# sfCKEditorPlugin
ckeditor:
basePath: /js/ckeditor
ckfinder:
active: true
basePath: /js/ckfinder
- Create autoload.yml file and put:
autoload:
ckeditor:
name: ckeditor
path: %sf_web_dir%/js/ckeditor
recursive: on
ckfinder:
name: ckfinder
path: %sf_web_dir%/js/ckfinder
recursive: on
- Add js files to the view.yml in this way:
javascripts: [ckeditor/ckeditor.js, ckfinder/ckfinder.js] - Edit /js/ckfinder/config.php... find CheckAuthentication() method and modify it to return true; however read the comments, it can be dangerous!
My solution: In production you will need to add a special cookie to the authenticated users, ex. imgupload... in this case you can use return isset($_COOKIE['imgupload']); in the function. - Change the $baseUrl to /js/ckfinder/userfiles/ in config.php
- Type symfony cc to clear the cache.
- Use the following syntax to call CKEditor:
$this->widgetSchema['my_editor'] = new sfWidgetFormCKEditor(); - I usually change the ckeditor interface. I remove the h1 tag and the unused functions. Try to put this to the ckeditor/config.js and refresh the browser window:
CKEDITOR.editorConfig = function( config )
{
//config.language = 'hu';
config.format_tags = 'p;h2;h3;h4;h5;h6';
config.height = 500;
config.entities = false;
config.disableNativeSpellChecker = false;
config.scayt_autoStartup = false;
};
CKEDITOR.config.toolbar_Full =
[
['Source'],
['Cut','Copy','Paste','PasteText','PasteFromWord','-','Print', 'Templates'],
['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],
'/',
['Bold','Italic','Underline','Strike','-','Subscript','Superscript'],
['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
['Link','Unlink','Anchor'],
'/',
['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar'],
['Format','FontSize'],
['TextColor','BGColor']
];
Wednesday, October 13, 2010
Install CKEditor and CKFinder in Symfony
Subscribe to:
Post Comments (Atom)
thank you so much for this :)
ReplyDeleteYou can install plugin just with plugin:install task with option --stability="beta" set.
ReplyDeleteI follow this step by step and CKEditor run. But when I press image icon and jump "Image properties" dialog box all crashed..... I guess, this is from configuration come. "Browse button" follow from config.js
ReplyDeleteconfig.filebrowserBrowseUrl = '/ckfinder/ckfinder.html';
and I going to address mydomain.com/ckfinder/ckfinder.html and nothing happen.. Where is problem. how can ran CKFinder properly.
Sorry for my bad English.