2010-07-02 124 views
0

我创建的形式简单的形式/ user.php的:渲染Zend_Form的(白色屏幕)

class Form_User extends Zend_Form 
{ 
     public function __construct() { 

     parent::__construct(); 
     $this->setName('form_user'); 

     $username = new Zend_Form_Element_Text('username'); 
     $password = new Zend_Form_Element_Password('password'); 
     $email = new Zend_Form_Element_Text('email'); 
     $submit = new Zend_Form_Element_Submit('submit'); 

     $this->addElements(array($username, $password, $email, $submit)); 
    } 
} 

我的控制器代码是:

public function registrationAction() 
    { 
     $this->view->title = 'Reg new acc!'; 
     $this->view->headTitle($this->view->title, 'PREPEND'); 

     $form = new Form_User(); 
     $this->view->form = $form; 

//  $this->view->form = 'test'; 
    } 

<?php echo $this->form; ?> 当我使我的形式没有发生,只有白色的屏幕。 当我在控制器$this->view->form = 'test';中使用此代码进行渲染时,它会显示“测试”文本。该怎么办?

+1

maybe $ form = new Application_Form_User()? ;) – opHASnoNAME 2010-07-02 11:37:27

+0

对不起,我的错误 - 没有应用程序_... – GeorgeMore 2010-07-02 11:43:12

回答

2

您可能已将error_reportingdisplay_errors关闭,因此当您尝试实例化Form_User时,您将看不到致命错误,应该是Application_Form_User

+0

错误在索引文件中 error_reporting(E_ALL | E_STRICT); ini_set('display_errors','on'); – GeorgeMore 2010-07-02 12:15:37

+0

application.ini中的设置是什么? Bootstrapping可以否决你在index.php – timdev 2010-07-02 19:47:36

+0

中设置的东西,它是创建新项目后的非标准设置 – GeorgeMore 2010-07-02 20:34:41