FCKeditor 2.6 在PHP+Zend Frameword 中的使用

本文介绍了FCKeditor在Zend Framework(ZF)中的集成步骤及使用要点,包括表单生成、获取表单值、配置注意事项及图片上传设置等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

具体的看FCKedit 官方文档,这里只记下了在ZF中的使用要点

一、表单生成

1.这里是在控制器中的动作:
public   function  fckeAction(){
            
$oFCKeditor   =   new  FCKeditor( ' FCKeditor1 ' );
            
$oFCKeditor -> BasePath  =   ' /fckeditor/ ' ;    // must add .htaccess file in fckeditor directory, the content of this file only include 'RewriteEngine off'
             $oFCKeditor -> Width = ' 600 ' ;
            
$oFCKeditor -> Height = ' 400 ' ;
            
$oFCKeditor -> Value  =   ' <p>This is some <strong>sample text</strong>. You are using <a href="http://www.fckeditor.net/">FCKeditor</a>.</p> '  ;              
            
$this -> view -> fckeditor  =   $oFCKeditor ;      // ->Create() ;    //in this controller, not to call FCKeditor->Create(), call it must in view page
             $this -> render();
        }


2.在 fcke.phtml 中:

< form name = " test "  action = " /test/getfck "  method = " POST " >
            
< ul >
                
< li > 用户 :   < input type = " text "  name = " userName "  value = ""   /></ li >
                
< li > 密码 :   < input type = " password "  name = " password "  value = ""   /></ li >
                
< li >
                    
<? php
                        
echo   $this -> fckeditor -> Create();
                    
?>
                
</ li >
            
</ ul >
            
< ul >
                
< li >< input type = " submit "  value = " 提交 "   />< input type = " reset "  value = " 取消 "   /></ li >
            
</ ul >
        
</ form >



二、获得表单值:

1.控制器中的动作
public   function  getfckAction(){
            
$this -> view -> userName = $sUser = $_POST [ ' userName ' ];
            
$this -> view -> password = $_POST [ ' password ' ];
            
$this -> view -> fckeValue  = $_POST [ ' FCKeditor1 ' ];
           
            
$this -> render();
        }


2. getfck.phtml
<? php
        
echo   $this -> escape( $this -> userName) . ' <br/> ' ;
        
echo   $this -> escape( $this -> password) . ' <br/> ' ;
        
echo   $this -> fckeValue . ' <br/> ' ;             // the FCKeditor already call htmlspecialchars() in fckeditor_5.php, not to use escape() on the view page;
         ?>


三、关键事项:

1.
 在 fckeditor 目录、你要放上传文件的 userfiles 目录,以及其它不用解析的 public 目录( 我的这三个目录同入口文件 index.php 一起放在html 目录下)里要加上 .htaccess 文件,如下:
RewriteEngine Off

2.
图片上传:
功能开启
编辑 fckeditor/editor/filemanager/connectors/php/config.php
  $Config [’Enabled’]  =   true  ;


四、在FCKeditor 2.6中。发现在上传文件过程中,通过浏览服务器按钮打开的页面来上传,与直接点上传按钮后,这两种情况会有不同的结果---传到服务器不同的目录里,前者要传到 image 目录下,后者却直接传到
userfiles 目录下,可能是个 bug。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值