備註:FCKeditor改名了,更名為CKeditor。
附上簡單的程式碼:
php部分:
include('ckeditor/ckeditor.php');
$CKEditor = new CKEditor();
$CKEditor->replace("editor1");
html部分:
<form>
<textarea class="ckeditor" name="editor1"></textarea>
</form>
補充:
預設是不能上傳圖片或檔案的,必須配合Ckfinder這個套件,請依步驟執行:
1.至官網下載PHP版本
2.解壓縮到ckeditor資料夾
3.開啟ckfinder/config.php,將CheckAuthentication的return值從false改成true,將$baseUrl改成你要放檔案的位置
4.回到主要的編輯網頁中,在head中加入js語法
<script type="text/javascript" src="ckeditor/ckfinder/ckfinder.js"></script>
5.找到<textarea class="ckeditor" name="editor1"></textarea>,在後面加入js語法
<script type="text/javascript"> CKEDITOR.replace( 'content', { filebrowserBrowseUrl : 'ckeditor/ckfinder/ckfinder.html', filebrowserImageBrowseUrl : 'ckeditor/ckfinder/ckfinder.html?Type=Images', filebrowserFlashBrowseUrl : 'ckeditor/ckfinder/ckfinder.html?Type=Flash', filebrowserUploadUrl : 'ckeditor/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files', filebrowserImageUploadUrl : 'ckeditor/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images', filebrowserFlashUploadUrl : 'ckeditor/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash' }); </script>
6.以上設定完畢後,打開編輯器的"影像",應該就會出現"瀏覽伺服器端"的按鈕了。
No comments:
Post a Comment