Home > 整站程序 > ecms fck 半自动 实现图片上传插入

ecms fck 半自动 实现图片上传插入

fck用php整合

php整合方法:
1,下载官方的文件,
include("fckeditor/fckeditor.php");//fck类加载
$oFCKeditor = new FCKeditor('newstext') ;  // 创建FCKeditor实例
$oFCKeditor->BasePath = 'fckeditor/';        // 设置FCKeditor目录地址
$FCKeditor->Width='100%';                //设置显示宽度
$FCKeditor->Height='300px';               //设置显示高度的高度
$oFCKeditor->Create() ;                    // 创建编辑器
2,需要修改部分文件
fckeditor_php5.php文件中的
// Render the linked hidden field下面的input改为textarea
fckeditor_php4.php也做相应修改
3,利用sablog的启发,调用fck的api
在addnews.php中加入下面的东西
<script>
//sablog
function addhtml(newstext){
 var oEditor = FCKeditorAPI.GetInstance('newstext');
 if ( oEditor.EditMode == FCK_EDITMODE_WYSIWYG ) {
  oEditor.InsertHtml(newstext) ;
 } else {
  alert('请先转换到所见即所得模式') ;
 }
}
var smdirurl = 'http://localhost';
//插入表情
function insertsmiley(icon){
 addhtml('<img src="'+smdirurl+icon+'" border="0" alt="" />');
}
</script>
4,在html/1.php中的合适位置增加
<tr><td>图片插入工具:</td><td>
 
<img src="/images/smiles/angry.gif" alt="" onclick="javascript:insertsmiley(document.add.titlepic.value)" /></td></tr>
5,做合适的修改,这是使用缩略图的对话框实现的,就是有些笨,用着还可以。

Categories: 整站程序 Tags: ,
  1. No comments yet.
  1. No trackbacks yet.

Note: Commenter is allowed to use '@User+blank' to automatically notify your reply to other commenter. e.g, if ABC is one of commenter of this post, then write '@ABC '(exclude ') will automatically send your comment to ABC. Using '@all ' to notify all previous commenters. Be sure that the value of User should exactly match with commenter's name (case sensitive).