Skip to content
biakaveron edited this page Sep 13, 2010 · 3 revisions

Configuration

Editor class has static properties:

  • $language
  • $default_driver

You can set them once (for example, in init.php or config file) to apply for all editor instances.

Each driver has its own static properties. For example, CKEditor driver has:

  • $path (path to editor folder)
  • $scriptname (main editor script filename)
  • $configfile (used for customizing)

You can just copy empty file classes/ckeditor.php into APPPATH and redefine these properties as you wish.

Example

// config/editor.php
Editor::$language = 'fr';
return array
(
// default configuration, will use Editor::$default_driver
  'default'    => array(
	'width' => 400,
	'height' => 600,
  ),
// used CKEditor driver with different skin
  'ckeditor' => array
  (
	'driver' => 'ckeditor',
	'width' => 400,
	'height' => 600,
	'fieldname' => 'text',
	'params' => array
	(
	  'skin' => 'office2003',
	),
  ),
);
// controller code
// create default editor instance 500x300
$editor = Editor::factory()->set('width', 500)->set('height', 300);
// include editor styles
foreach($editor->css() as $css)
  echo html::style($css);
// include editor scripts
foreach($editor->js() as $js)
  echo html::script($css);
// show textarea field and apply editor
$editor->render();
Clone this wiki locally