public function actionIndex() { require_once __DIR__ . '/../models/LoginForm.php'; $form = new LoginForm(); if (isset($_POST) && sizeof($_POST) > 0 && $form->isValid($_POST)) { $this->redirect($form->getRedirect()); } $this->render('index', array('form' => $form->render())); }
} /** * Method to allow non-MVC usage of Zend_Form so the * elements actually render correctly * * @param Zend_View_Interface $view */ public function setView(Zend_View_Interface $view = null) { parent::setView($view); foreach ($this->getElements() as $item) { $item->setView($view); } return $this; } } // create a view $view = new Zend_View(); $view->doctype('XHTML1_TRANSITIONAL'); $form = new LoginForm(); $form->setView($view); // if the form is submitted if (strtolower($_SERVER['REQUEST_METHOD']) == 'post') { if ($form->isValid($_POST)) { echo "Successful attempt!"; die; } echo "There was an error with the form<br /><br />"; } echo $form->render();
<div style="clear: both;"> </div> <div id="footer"> <p><?php rcms_show_element('copyright'); ?> <?php // Page gentime end $mtime = explode(' ', microtime()); $totaltime = $mtime[0] + $mtime[1] - $starttime; print __('GT:') . round($totaltime, 2); print ' QC: ' . $query_counter; ?> </p> <?php } else { $ubLoginForm = new LoginForm(); print $ubLoginForm->render(); } ?> </div> </body> </html>
<p><strong><?rcms_show_element('copyright')?> </strong></p> <p> <?php // Page gentime end $mtime = explode(' ', microtime()); $totaltime = $mtime[0] + $mtime[1] - $starttime; print __('GT:') . round($totaltime, 2); print ' QC: ' . $query_counter; ?> </p> </footer> </aside><!-- end of sidebar --> <section id="main" class="column"> <article class="module width_full"> <?rcms_show_element('menu_point', 'up_center@window')?> <?rcms_show_element('main_point', $module . '@window')?> </article> <div class="spacer"></div> </section> <? } else { $ubLoginForm=new LoginForm(); print($ubLoginForm->render()); } ?> </body> </html>