Revision: 29348
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at July 27, 2010 20:53 by jiewmeng
Initial Code
// Login form class $controllerFront = Zend_Controller_Front::getInstance(); $returnUrl = $controllerFront->getRequest()->getRequestUri(); $this->addElement('hidden', 'returnUrl', array( 'value' => $returnUrl )); // AuthController // inside loginAction() - after authentication is successful $returnUrl = $form->getElement('returnUrl')->getValue(); if (!empty($returnUrl)) { $this->_helper->getHelper('Redirector')->setGotoUrl($returnUrl); }
Initial URL
Initial Description
redirecting back to where the user came from is a very common functionality in login forms. technical implementation: - have a hidden field (`returnUrl`) - populated by current url (in Zend Framework, i get this using the request's `getRequestUri()` function) - in the `AuthController`, if the `returnUrl` field is set, i will redirect the user to that page using the `Redirector` helper.
Initial Title
Zend Framework: Having forms redirect back to page user came from
Initial Tags
Initial Language
PHP