CodeIgniter でシンプルな CMS を作成しようとしています。テキストエリア用に Tinymce を使用することにしましたが、実装に問題がありました。
これは、それを設定しようとした方法です:
フォルダ構造:
- public
-- css
-- js
-- images
- system
-- <all CI folders here>
public フォルダーを指すようにこのヘルパーを作成しました。
function asset_url(){
return base_url().'public/';
}
tinymce 初期化ファイル:
<script src="<?=base_url()?>scripts/tiny_mce/tiny_mce.js" type="text/javascript">
tinyMCE.init({
theme : "advanced",
mode : "textareas",
plugins : "imagemanager,filemanager,insertdatetime,preview,emotions,visualchars,nonbreaking",
theme_advanced_buttons1_add: 'insertimage,insertfile',
theme_advanced_buttons2_add: 'separator,forecolor,backcolor',
theme_advanced_buttons3_add: 'emotions,insertdate,inserttime,preview,visualchars,nonbreaking',
theme_advanced_disable: "styleselect,formatselect,removeformat",
plugin_insertdate_dateFormat : "%Y-%m-%d",
plugin_insertdate_timeFormat : "%H:%M:%S",
theme_advanced_toolbar_align : "left",
theme_advanced_resize_horizontal : false,
theme_advanced_resizing : true,
apply_source_formatting : true,
spellchecker_languages : "+English=en",
extended_valid_elements :"img[src|border=0|alt|title|width|height|align|name],"
+"a[href|target|name|title],"
+"p,"
invalid_elements: "table,span,tr,td,tbody,font"
});
</script>
これは私の見解です:
<html>
<head>
<script type="text/javascript" src='<?php echo asset_url()."js/tiny_mce/tiny_mce.js" ?>'></script>
<script type="text/javascript" src='<?php echo asset_url()."js/tiny_mce/tinymce_properties.js" ?>'></script>
</head>
<body>
<form method="post" action="somepage">
<textarea name="content" style="width:100%">
</textarea>
</form>
</body>
</html>
そのため、今のところ、tinymce エディターの代わりに空の通常のテキストエリアが表示されます。JS ファイルが読み込まれていますが、エラーはありません。
うまくいけば、誰かが私に手がかりを与えることができます!