Customizing FCK Editor toolbars in PHP
[ More ] Jan 18, 2009 | 1 Comment | Posted in PHP, Tech, Web Development |The ’CustomConfigurationsPath’ setting of FCK editor provides a great deal of customizations and configurations for users of FCKEditor. I was implementing FCK editor in one of the projects and the default interface toolbars occupy almost 50 % of the screen area of the editor control. Most of the toolbar options are unnecessary, so I used the ‘’CustomConfigurationsPath’ property to provide FCKEditor with a custom configuration file to get the right settings.
Default Code
/TestProject/test1.php
include_once 'includes/fckeditor/fckeditor.php';
$oFCKeditor = new FCKeditor('txtQuesText') ;
$oFCKeditor->BasePath = './includes/fckeditor/' ;
$oFCKeditor->Width = 600;
$oFCKeditor->Height = 300;
$oFCKeditor->Value = '' ;
$oFCKeditor->Create() ;
The code will render as follows
![]() |
![]() |
In order to customize the FCK editor, you will have create a FCK Editor Setting file, like the following javascript file
/TestProject/includes/fck_editor_config.js
FCKConfig.ToolbarSets["TestToolbar"] = [ ['Source','-'], ['Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript'], ['OrderedList','UnorderedList','-'], ['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'], ['Link','Unlink'], ];
The settings file has to be connected to the PHP script that loads the FCKEditor and the appropriate settings that have to be loaded have to be configured in the PHP Script (in this case it is “TestToolbar”). This methods, multiple settings to be configured as a part of the settings file and allows dynamic swapping of editor control properties.
PHP Script with settings file loaded
$oFCKeditor = new FCKeditor('txtQuesText') ;
$oFCKeditor->BasePath = './includes/fckeditor/' ;
$oFCKeditor->Config["CustomConfigurationsPath"] = "/TestProject/includes/fck_editor_config.js";
$oFCKeditor->ToolbarSet = 'TestToolbar';
$oFCKeditor->Width = 600;
$oFCKeditor->Height = 200;
$oFCKeditor->Value = '' ;
$oFCKeditor->Create() ;
Result
[ View Post ]



