We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Forward to another Action from Action

Can I forward the dispatcher to another Action?

For example, by some reasons I want to display the "Not Found" page without continuing current Action. "Not Found" page is a separately Action in another Controller.



404
Accepted
answer

Yes, you can.

$this->dispatcher->forward(array( "controller" => "your-controller", "action" => "your-action" ));

return false;

For more details read: https://docs.phalcon.io/en/latest/reference/dispatching.html#forwarding-to-other-actions

Thanks.

I tried to use this method, but the small error in one of my dispatchers brake it. I fix this error and all is OK now.