<?php
echo $cksource->create('Post'); echo $form->input('title'); echo $form->hidden('user_name', array('value'=>$User['User']['username'])); echo $form->hidden('user_id', array('value'=>$User['User']['id'])); echo $cksource->ckeditor('body');
$config['toolbar'] = array( array('Source', '-', 'Bold', 'Italic', 'Underline', 'Strike' ), array( 'Image', 'Link', 'Unlink', 'Anchor' ) );
$events['instanceSave'] = 'function (ev) {
alert("Loaded: " + ev.editor.name);
}';
?>
Robię to przez helpera do cakea
<?php
class CksourceHelper extends FormHelper {
var $helpers = array('Html');
function ckeditor
($fieldName, $options = array()) { //CakePHP 1.2.4.8284
$options = $this->_initInputField($fieldName, $options);
//If you have probelms, try adding a second underscore to _initInputField. I haven't tested this, but some commenters say it works.
//$options = $this->__initInputField($fieldName, $options);
$value = null;
$config = null;
$events = null;
$value = $options['value'];
$value = h($value);
}
unset($options['value']); }
$config = $options['config'];
unset($options['config']); }
$events = $options['events'];
unset($options['events']); }
require_once WWW_ROOT . DS . 'js' . DS . 'ckeditor' . DS . 'ckeditor.php';
$CKEditor = new CKEditor();
$CKEditor->basePath = $this->webroot . 'js/ckeditor/';
return $CKEditor->editor($options['name'], $value, $config, $events);
}
}
?>
Udało się ! Problem leżał w helperze. Klasyczną metodą wszystko działa tak jak powinno.
Temat można zamknąć.
Pozdrawiam.