(on Friday, 22 October 2010, 04:48 PM +0200):
> This is more of an architectual question which should lead for me to a
> development decision.
> I sometimes in my application have some links. But in order to see what's
> behind the links you have to be logged in. So the user is redirected to a
> login page.
> But I want the user to be redirected to the original page after he has
> logged in.
>
> What's the best way to implement this in a zf based site?
Grab the referer from the request object:
// In an action method of a controller
$request = $this->getRequest();
if (/* some op succeeded */) {
$origin = $request->getHeader('referer');
return $this->_redirect($origin);
}
That's really all there is to it.
--
Matthew Weier O'Phinney
Project Lead | matthew@zend.com
Zend Framework | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc
没有评论:
发表评论