Home > EC-CUBE | カスタマイズ > EC-CUBEでFCKeditorを使う

EC-CUBEでFCKeditorを使う

商品登録ページの詳細-メインコメントの部分を、WYSIWYG編集できるようにFCKeditorを使えるようにする。

EC-CUBE 2.3.0

まず、こちらのサイト

AjaxなWYSIWYGエディタ、FCKeditor 2.6 日本語版をリリースしたよ。

から FCKeditor_2.6_ja.zip をダウンロードし、解凍してから fckeditor ディレクトリをアップロード。
(アップロードする場所は html/fckeditor)

/data/Smarty/templates/default/admin/main_frame.tpl の39行目あたりに下記の3行目の部分を挿入。

<script type=”text/javascript” src=”<!–{$TPL_DIR}–>js/css.js”></script>
<script type=”text/javascript” src=”<!–{$TPL_DIR}–>js/file_manager.js”></script>
<script type=”text/javascript” src=”<!–{$smarty.const.URL_DIR}–>/fckeditor/fckeditor.js”></script>

/data/Smarty/templates/default/admin/products/product.tpl に

<script type=”text/javascript”>
$(function(){
var oFCKeditor = new FCKeditor( ‘main_comment’ ) ;
oFCKeditor.ReplaceTextarea() ;
oFCKeditor.ToolbarSet = ‘EC-CUBE‘ ; //ツールバーの設定
});
</script>

を追加。

html/fckeditor/fckeditor.js 下記のように適宜修正。

var FCKeditor = function( instanceName, width, height, toolbarSet, value )
{
// Properties
this.InstanceName    = instanceName ;
this.Width            = width            || ’100%’ ;
this.Height            = height        || ‘300‘ ;// 初期設定は200
this.ToolbarSet        = toolbarSet    || ‘EC-CUBE‘ ;// ←ツールバーセットの指定
this.Value            = value            || ” ;
this.BasePath        = FCKeditor.BasePath ;
this.CheckBrowser    = true ;
this.DisplayErrors    = true ;

this.Config            = new Object() ;

// Events
this.OnError        = null ;    // function( source, errorNumber, errorDescription )
}

そして、50行目あたり

FCKeditor.BasePath = ‘/fckeditor/’ ;

FCKeditor.BasePath = ‘/html/fckeditor/’ ;

に修正。

html/fckeditor/fckconfig.js の45行目あたりでスキンの指定をする。(これはスキンを変更したいときだけ)

FCKConfig.SkinPath = FCKConfig.BasePath + ‘skins/silver/’ ;

137行目あたりにツールバーセットを追加。(下記はEC-CUBE用にシンプルにしてみたサンプル)

FCKConfig.ToolbarSets["EC-CUBE"] = [
['Source'],
['Bold','Italic','Underline','StrikeThrough'],
['OrderedList','UnorderedList'],
['JustifyLeft','JustifyCenter','JustifyRight'],
['Table','Rule','Smiley'],
['TextColor'],
['FitWindow'],
‘/’,
['FontFormat','FontSize'],['RemoveFormat'],
// No comma for the last row.
] ;

これでOK!

Comments:3

カンパニー松本 09-05-04 (月) 2:40

コレ試してみたんですが、テキストエリアが「Not found」になります。
http://www.cyber-will.co.jp/blog/2008/05/19/28
コレも参考にしましたが、ダメでした。
何が悪いんでしょう。
途方に暮れています…

admin 09-05-04 (月) 13:37

カンパニー松本さん、

あなたがお使いの環境がわかりませんが、サーバーによってうまくいかないこともありました。
この記事は、
PHP 4.3.9
PostgreSQL 7.4.17
での作業でしたが、php 5.2.5の環境ではうまく動作しなかったようです。
参考になりますでしょうか。

カンパニー松本 09-05-04 (月) 23:24

お世話になります。
当方、
EC-CUBEバージョン 2.3.4
PHPバージョン PHP 5.2.6
DBバージョン MySQL 5.0.77
OSは、fedora10みたいな感じでやってます。
MTでは、特定フォルダの上書き程度のことで、すぐ使えるようになったのですが…
何が悪いのか、検討がつきません…

Comment Form
Remember personal info

Trackbacks:0

Trackback URL for this entry
http://www.wiz.gr.jp/wordpress/64/trackback
Listed below are links to weblogs that reference
EC-CUBEでFCKeditorを使う from WIZ-WORDPRESS│EC-CUBE-LABO

Home > EC-CUBE | カスタマイズ > EC-CUBEでFCKeditorを使う

Return to page top