ZF-5641: Anchor links (hashes) in urls and redirects


To my knowledge it's not possible to use the redirector together with hashes in an easy manner, eg. /post/view/id/12/#comment327

Apart from array('controller' => 'user', 'action' => 'view', 'useess' => '#hash') to generate "/user/view/useless/#hash", which isn't very nice, I don't think this is possible.


Hi Sandström,

The following should get you what you want:

    $opt = array('controller' => $controller, 'action' => $action);
    $url  = $this->_helper->getHelper('Url')->url($opt, $routeName);
    $url .= "#$resourceId";

    return $this->_helper->redirector->gotoUrl($url);

Functionality requested already exists.