php中快速使用fckeditor

来源:互联网 发布:合肥java程序员工资 编辑:程序博客网 时间:2024/05/01 21:17

  fckeditor是老牌的东西,之前用ewebeditor的,最近一个项目里是fckeditor,则其实可以这样用.

 

1 当然要先准备好fckeditor目录了.

2 在editor中,可以如下代码:
   //调用编辑器主体
include('editor/fckeditor.php') ;
//设置内容区域
$oFCKeditor = new FCKeditor('content');
$oFCKeditor->Value = $article['content'];

$contentarea = $oFCKeditor->CreateHtml();

 

其中$article['content']就是文章内容的变量.

 

然后在要用到编辑器的页面,
include('editor.php');

smarty模版里面
   $smarty->assign("contentarea",$contentarea);

 

模版文件里
   <td>{contentarea}></td>就可以了

内容框里提交的内容就是contentarea

 

 

原创粉丝点击