Search code examples
phpphalconphalcon-routing

Forward anchor withing page in Phalcon


In Phalcon I finish one of my actions with forward response with parameters and I would need adding an anchor (e.g. to end the forwarded response with #blabla.

return $this->dispatcher->forward(array(
    'controller' => 'foo',
    'action' => 'bar',
    'params' => array(123),
));

Is that possible?


Solution

  • Dispatcher does not change the URL in your address bar. It just simulates(loads) the requested route. However it is possible to do this with redirect:

    $url = $this->url->get(['for' => 'your-route-name']);
    return $this->response->redirect($url . '#hash-here');