cakephp ブログエディター ckeditor

■ckeditor
http://ckeditor.com/

■kcfinder(≠ ckfinder)
https://github.com/sunhater/kcfinder

各フォルダをjsに配置

■js/ckeditor/config.php

CKEDITOR.editorConfig = function( config ) {
    ・・・・・・・・・・・・・・・・・・・・・・・・

    // ※パスは調整
    config.filebrowserBrowseUrl = '/js/kcfinder/browse.php?type=files';
    config.filebrowserImageBrowseUrl = '/js/kcfinder/browse.php?type=images';
    config.filebrowserFlashBrowseUrl = '/js/kcfinder/browse.php?type=flash';
    config.filebrowserUploadUrl = '/js/kcfinder/upload.php?type=files';
    config.filebrowserImageUploadUrl = '/js/kcfinder/upload.php?type=images';
    config.filebrowserFlashUploadUrl = '/js/kcfinder/upload.php?type=flash';
}

■ビュー

<?php $this->Html->script('ckeditor/ckeditor', array('inline' => false));?>
<script type="text/javascript">
if (typeof CKEDITOR != 'undefined') {
	var editor = CKEDITOR.replace('editor1');
}
</script>

<?php echo $this->Form->create('Blog'); ?>
<?php echo $this->Form->input('text', array('class'=>'ckeditor', 'id'=>'editor1')); ?>
<?php echo $this->Form->end(__('Submit')); ?>
PAGE TOP