0

When a certain domain is requested, I would like to display page genereted by defined controller / action. I tried using hostname route (in this case requesting www.some-page.de should dispatch transportAction in IndexController), like this:

$hostnameRoute = new Zend_Controller_Router_Route_Hostname(
    'www.some-page.de',
    array(
        'controller' => 'index',
        'action'     => 'transport'
    )
);

$plainPathRoute = new Zend_Controller_Router_Route_Static('');

$router->addRoute('transport', $hostnameRoute->chain($plainPathRoute));

Apparently I am doing something wrong, because it isn't working (instead indexAction of IndexController is being dispatched). Any hints or ideas how can I achieve this?

4

1 回答 1

0

我明白了——这很简单,我希望这也是一种很好的做法:

在插件的 routeShutdown 挂钩中,我检查域名(使用 $_SERVER['HTTP_HOST']),如果它是所需的域,我使用以下代码设置操作名称:

$request->setActionName('transport');
于 2012-06-04T16:54:37.100 回答