![]() |
|
Snippets |
|
Here is a very basic script which should come in handy to anyone trying to set up a login redirection (to the referer) whilst maintaining parameters being passed through the url.
Using $this->getRequest()->getReferer(); will only pass through the module and action.
public function executeLogin() { //This captures the referer's uri $referer = sfRouting::getInstance()->getCurrentInternalUri(true); if ($this->getRequest()->getMethod() != sfRequest::POST) { $this->getRequest()->getParameterHolder()->set('referer', $referer); } } public function executeChecklogin() { //if the referer isn't set, set it to the home page $referer = $this->getRequestParameter('referer', '@homepage'); //if the referer is the login page itself, refer to the home page if($referer == 'user/login') $referer = '@homepage'; return $this->redirect($referer); }