Php 如何使用zend framework制作自定义图像文件表单

Php 如何使用zend framework制作自定义图像文件表单,php,zend-framework,zend-form-element,Php,Zend Framework,Zend Form Element,如何通过扩展zend form元素来创建自定义图像文件?html格式的输出如下所示: <div class="image-file-wrapper"> <img src="yourimagepath" /> <br /> <input id="image-file" name="image-file" type="file" /> </div> 我的自定义视图帮助程序: class Engine_View

如何通过扩展zend form元素来创建自定义图像文件?html格式的输出如下所示:

<div class="image-file-wrapper">
     <img src="yourimagepath" />
     <br />
     <input id="image-file" name="image-file" type="file" />
</div>
我的自定义视图帮助程序:

class Engine_View_Helper_FormImageFile extends Zend_View_Helper_FormElement {
public function formImageFile($name, $value = null, $attribs = null, $options = null) {
    return '<div class="image-file-wrapper"><img src="test.png" /><input type="file" /></div>';    
}    
}
发生错误:

Warning: Exception caught by form: No file decorator found... unable to render file element Stack Trace: #0 C:\xampp\htdocs\NEOBBS_v6\library\Zend\Form\Decorator\FormElements.php(101): Zend_Form_Element_File->render() #1 C:\xampp\htdocs\NEOBBS_v6\library\Zend\Form.php(2904): Zend_Form_Decorator_FormElements->render('') #2 C:\xampp\htdocs\NEOBBS_v6\library\Zend\Form.php(2920): Zend_Form->render() #3 C:\xampp\htdocs\NEOBBS_v6\application\themes\admin\settings.phtml(8): Zend_Form->__toString() #4 C:\xampp\htdocs\NEOBBS_v6\library\Zend\View.php(108): include('C:\xampp\htdocs...') #5 C:\xampp\htdocs\NEOBBS_v6\library\Zend\View\Abstract.php(880): Zend_View->_run('C:\xampp\htdocs...') #6 C:\xampp\htdocs\NEOBBS_v6\library\Zend\Controller\Action\Helper\ViewRenderer.php(897): Zend_View_Abstract->render('settings.phtml') #7 C:\xampp\htdocs\NEOBBS_v6\library\Zend\Controller\Action.php(243): Zend_Controller_Action_Helper_ViewRenderer->renderScript('settings.phtml', NULL) #8 C:\xampp\htdocs\NEOBBS_v6\application\modules\admin\contr in C:\xampp\htdocs\NEOBBS_v6\library\Zend\Form.php on line 2925
我怎么修理它

提前感谢,


Brian使用Zend\u Form\u Decorator\u ViewScript。有关详细信息:

是的,但我总是收到错误:警告:表单捕获的异常:注册表中找不到名为“FormImageFile”的插件;使用的路径:
$this->addElement('ImageFile', 'imageFile', array('label' => 'Test Image'));
Warning: Exception caught by form: No file decorator found... unable to render file element Stack Trace: #0 C:\xampp\htdocs\NEOBBS_v6\library\Zend\Form\Decorator\FormElements.php(101): Zend_Form_Element_File->render() #1 C:\xampp\htdocs\NEOBBS_v6\library\Zend\Form.php(2904): Zend_Form_Decorator_FormElements->render('') #2 C:\xampp\htdocs\NEOBBS_v6\library\Zend\Form.php(2920): Zend_Form->render() #3 C:\xampp\htdocs\NEOBBS_v6\application\themes\admin\settings.phtml(8): Zend_Form->__toString() #4 C:\xampp\htdocs\NEOBBS_v6\library\Zend\View.php(108): include('C:\xampp\htdocs...') #5 C:\xampp\htdocs\NEOBBS_v6\library\Zend\View\Abstract.php(880): Zend_View->_run('C:\xampp\htdocs...') #6 C:\xampp\htdocs\NEOBBS_v6\library\Zend\Controller\Action\Helper\ViewRenderer.php(897): Zend_View_Abstract->render('settings.phtml') #7 C:\xampp\htdocs\NEOBBS_v6\library\Zend\Controller\Action.php(243): Zend_Controller_Action_Helper_ViewRenderer->renderScript('settings.phtml', NULL) #8 C:\xampp\htdocs\NEOBBS_v6\application\modules\admin\contr in C:\xampp\htdocs\NEOBBS_v6\library\Zend\Form.php on line 2925