http://wiki.ec-orange2.jp/index.php?%E3%82%AB%E3%82%B9%E3%82%BF%E3%83%9E%E3%82%A4%E3%82%BA%EF%BC%9A%E5%BF%9C%E7%94%A8%2F%E3%82%A8%E3%83%87%E3%82%A3%E3%82%BF%E3%81%AE%E3%83%AA%E3%83%83%E3%83%81%E5%8C%96
を参照させて頂きました。(補足付き)
fckconfig.jsの編集
解凍して作成されたfckeditor/fckconfig.jsを編集します。
//FCKConfig.ProtectedSource.Add( /<\?[\s\S]*?\?>/g ) ; // PHP style server side code↓FCKConfig.ProtectedSource.Add( /<\?[\s\S]*?\?>/g ) ; // PHP style server side codevar _FileBrowserLanguage = 'php' ; ←'php'を設定var _QuickUploadLanguage = 'php' ; ←'php'を設定
fckeditor.jsの編集
FCKeditorのパスを設定します。
ショップのドキュメントルート+/user_data/fckeditor/
としておきます。
FCKeditor.BasePath = '/shop/user_data/fckeditor/' ;
アップローダー設定
config.phpの編集
ファイルアップロードのサーバーサイドのスクリプト設定を行います。
/html/user_data/fckeditor/editor/filemanager/connectors/php/config.php
を編集します。
$Config['Enabled'] = true ; ←trueにする↓アップロードしたファイルの保存先(ドキュメントルートからのパス)$Config['UserFilesPath'] = '(ここはURLにします。)/shop/upload/save_image/’ ;↓アップロードしたファイルの(絶対パス)$Config[’UserFilesAbsolutePath’] = ‘/var/www/eccubes/html/upload/save_image/’ ; ↓アップロード出来るファイルを画像ファイルのみに変更 $Config[’AllowedExtensions’][’File’] = array(’gif’, ‘jpeg’, ‘jpg’, ‘png’) ;
※FCKeditorのファイルアップロード機能はユーザー認証を必要としません。第三者が勝手にファイルをアップロードする事が可能なので、利用する際は注意してください。
テンプレートの編集
htmlの<head>内で必要な時だけ呼び出すために
data/Smarty/templates/default/admin/main_frame.tpl
の<head>~</head>に以下を追加します。
<!--{$tpl_head_option|smarty:nodefaults}-->
pageクラスの編集
FCKeditorを使用するページのクラスを編集します
- LC_Page_Admin_Design_Bloc.php 192行目付近
以下のように変更してください。default: $this->tpl_javascript .= “ function fckeditorCreate(){var oFCKeditor = new FCKeditor( ‘bloc_html’ ) ;oFCKeditor.Height=’420′; oFCKeditor.ReplaceTextarea() ; } “; $this->tpl_head_option = ‘<script type=”text/javascript” src=”‘.URL_DIR.‘user_data/fckeditor/fckeditor.js”></script>‘; $this->tpl_onload .= ‘fckeditorCreate()‘; if(isset($_POST[‘mode‘])) { GC_Utils::gfPrintLog(“MODEエラー:“.$_POST[‘mode‘]); } break;
- LC_Page_Admin_Design_MainEdit.php 227行目付近
以下のように変更してください$this->tpl_javascript .= “ function fckeditorCreate(){var oFCKeditor = new FCKeditor( ‘tpl_data’ ) ;oFCKeditor.Height=’620′; oFCKeditor.ReplaceTextarea() ; } “; $this->tpl_head_option = ‘<script type=”text/javascript” src=”‘.URL_DIR.‘user_data/fckeditor/fckeditor.js”></script>‘; $this->tpl_onload .= ‘fckeditorCreate()‘; // 画面の表示 $objView->assignobj($this);
- LC_Page_Admin_Products_Product.php
まず以下の関数を追加しますfunction lfSetFCKeditor(){ $this->tpl_javascript .= “ function fckeditorCreate(){var oFCKeditor = new FCKeditor() ;oFCKeditor.BasePath = ‘/shop/user_data/fckeditor/’ ; oFCKeditor.Height=’420′; oFCKeditor.InstanceName = ‘main_comment’; oFCKeditor.ReplaceTextarea() ; for (i = 1; i < 6; i++) { oFCKeditor.InstanceName = ’sub_comment’+i; oFCKeditor.ReplaceTextarea() ; } } “; $this->tpl_head_option .= ‘<script type=”text/javascript” src=”‘.URL_DIR.‘user_data/fckeditor/fckeditor.js”></script>‘; $this->tpl_onload .= ‘fckeditorCreate();‘; }
lfProductPage()の中を以下のように修正します。
if (isset($_POST[‘image_key‘]) && !empty($_POST[‘image_key‘])) { $anchor_hash = “location.hash=’#“ . $_POST[‘image_key‘] . “‘“; } elseif (isset($_POST[‘anchor_key‘]) && !empty($_POST[‘anchor_key‘])) { $anchor_hash = “location.hash=’#“ . $_POST[‘anchor_key‘] . “‘“; } else { $anchor_hash = ““; }
↓
if (isset($_POST[‘image_key‘]) && !empty($_POST[‘image_key‘])) { $anchor_hash = “location.hash=’#“ . $_POST[‘image_key‘] . “‘;“; } elseif (isset($_POST[‘anchor_key‘]) && !empty($_POST[‘anchor_key‘])) { $anchor_hash = “location.hash=’#“ . $_POST[‘anchor_key‘] . “‘;“; } else { $anchor_hash = ““; }
また、lfProductPage()の最後に以下の行を追加します。
$this->lfSetFCKeditor();
- detail.tpl
main_commentとsub_comment1~5のnl2brを削除してください。
許可するタグの追加
管理画面のシステム設定→マスタデータ管理でmtb_allowed_tagに入力許可するタグを追加します。
トラックバック URL :