渲染Zend_Form(白色屏幕)

时间:2010-07-02 11:34:48

标签: php zend-framework zend-form

我在forms / user.php中创建了简单的表单:

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 个答案:

答案 0 :(得分:2)

您可能已关闭error_reportingdisplay_errors,因此当您尝试实例化Form_User时,您不会看到致命错误,Application_Form_User应为{{1}} }。