2010-07-02 131 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