2010-03-07 86 views
0

这是在引导文件我的路由定义:Zend_Controller_Router静态路由

$router = $this->frontController->getRouter(); 
    $route = new Zend_Controller_Router_Route_Static(
     'tipovanie', 
     array('module' => 'default', 
       'controller' => 'index', 
       'action' => 'contest') 
    ); 
    $router->addRoute('contest', $route); 

现在,当我去/ tipovanie我得到正确显示相同的内容,在/索引/较量。

不过,我使用的URL视图助手来构建我的布局像这样的一些链接:

<a href="<?php 

echo $this->url(array('module' => 'default', 
         'controller' => 'view', 
         'action' => 'user', 
         'id' => $this->escape($u->id)), 
       null, 
       true); 

       ?>"><?php echo $this->escape($u->username); ?></a> 

而这些链接指向:

/tipovanie 

当查看/ tipovanie页。在没有静态重写路由的其他页面上,url视图助手工作正常,并且打印的链接是正确的(例如/ view/user/id/5)。

回答

0

我是个白痴。我忘了指定这些链接的默认路由:

<a href="<?php 

echo $this->url(array('module' => 'default', 
         'controller' => 'view', 
         'action' => 'user', 
         'id' => $this->escape($u->id)), 
       'default', 
       true); 

       ?>"><?php echo $this->escape($u->username); ?></a>