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

Issue Type: Improvement Created: 2009-01-27T07:55:11.000+0000 Last Updated: 2010-12-21T00:14:47.000+0000 Status: Closed Fix version(s): Reporter: removed user (sandstrom) Assignee: Wil Moore III (wilmoore) (wilmoore) Tags: - Zend_Controller

  • Zend_View

Related issues: Attachments:


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.


Posted by Wil Moore III (wilmoore) (wilmoore) on 2010-12-21T00:12:49.000+0000

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);

Posted by Wil Moore III (wilmoore) (wilmoore) on 2010-12-21T00:14:04.000+0000

Functionality requested already exists.

Have you found an issue?

See the Overview section for more details.


© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.