E
E
excalibur2013-04-23 16:12:43
Zend Framework
excalibur, 2013-04-23 16:12:43

Find out which router processes a specific url?

I have a set of urls in my controller, for example:
_www.mydomain.com/blog/blog-item-12345.html
news.mydomain.com/last-news-6789.html
another-subdomain.mydomain.com/path/path /id/…
How to find out which router processes each url? Those. I need to know the module, controller and action that will be called.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
anitspam, 2013-04-24
@anitspam

I won’t tell you specifically, but this is usually configured in application/Bootstrap.php in the _initRoutes() function or through configuration files.

$router->addRoute($name,
                new Zend_Controller_Router_Route($url,
                    array('module' => $module, 'controller' => $controller, 'action' => $action, )));

M
mbt, 2013-11-14
@mbt

So have you tried it?

In controller:


$request = $this->getRequest();
$controllerName = $request->getControllerName();
$actionName = $request->getActionName();
$moduleName = $request->getModuleName();

in the other place:


$request =  Zend_Controller_Front::getInstance()->getRequest();
$controllerName = $request->getControllerName();
$actionName = $request->getActionName();
$moduleName = $request->getModuleName();

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question