jest taki fragment dotyczący ogólenie klasy Zend_Form a bardziej szczegółowo tworzenia forumarza i przesyłania go do widoku.
Pytanie: Czy metoda getForm nie powinna zwracać czegoś w rodzaju
return new Zend_Form_Login();
przy założeniu, że forumlarz znjaduje się w application/forms/Login.php nie kapuje co to jest return $form; w tym kontkście wywołania
class UserController extends Zend_Controller_Action { public function getForm() { // create form as above return $form; } public function indexAction() { // render user/form.phtml $this->view->form = $this->getForm(); $this->render('form'); } public function loginAction() { if (!$this->getRequest()->isPost()) { return $this->_forward('index'); } $form = $this->getForm(); if (!$form->isValid($_POST)) { // Failed validation; redisplay form $this->view->form = $form; return $this->render('form'); } $values = $form->getValues(); // now try and authenticate.... } }