1

We have a strange issue with the navigation xml, here's a snippet:

...
<registration>
      <label>Registration</label>
      <module>mine</module>
      <controller>registration</controller>
      <pages>
          <register>
             <label>Register</label>
             <module>mine</module>
             <controller>registration</controller>
             <action>doregistration</action>
           </register>
      </pages>
</registration>
...

Every time we call the /mine/registration/index action, the /mine/registration/doregistration action gets triggered afterwards (when debugging it can take a second or two)

The /mine/registration/index does get displayed correctly.

This problem occurs throughout the whole application. When we change the action of the second (or sub-) page, this particular action is executed.

Is this a known issue in Zend? Has anyone had this problem before?

4

2 回答 2

0

也许这个例子,来自同一个应用程序,同样的问题,让事情更清楚:

navigation.xml

...
<over>
    <label>Over ons</label>
    <module>default</module>
    <controller>over</controller>
    <action>index</action>
    <pages>
        <wat>
            <label>Wat?</label>
            <module>default</module>
            <controller>over</controller>
            <action>wat</action>
        </wat>
        <wie>
            <label>Wie?</label>
            <module>default</module>
            <controller>over</controller>
            <action>wie</action>
        </wie>
        <contact>
            <label>Contact</label>
            <module>default</module>
            <controller>over</controller>
            <action>contact</action>
        </contact>
        <faq>
            <label>Help</label>
            <module>default</module>
            <controller>over</controller>
            <action>faq</action>
        </faq>
    </pages>
</over>
...

对应的OverController看起来像这样:

class Default_OverController extends Custom_Controller_Action_EhcAction
{

public function indexAction()
{
    return $this->render('index');
}

public function contactAction()
{
    return $this->render('contact');
}

public function wieAction()
{
    return $this->render('wie');
}

public function watAction()
{
    return $this->render('wat');
}

public function faqAction()
{
    return $this->render('faq');
}
}

如您所见,我们的控制器扩展了Custom_Controller_Action_EhcAction. 这是一个自定义类,它扩展Zend_Controller_Action并添加了一些额外的功能(日志记录、登录用户的身份,...)。这个自定义类不可能是我们问题的原因,如果我们不使用它仍然会发生。

在本例中,如果我们执行default/over/wat操作,应用程序还将调用以下节点default/over/wie。如果我们在 XML 中切换位置,结果是第二个调用始终是下一个或第一个底层节点。

我们不认为他们是 JavaScript 调用,因为如果我们检查与 Charles 的流量,只会调度一个调用。

此示例的视图脚本仅包含简单的 HTML,没有任何 PHP 或 JS...

希望这将使我们的问题更清楚......

于 2012-05-03T11:40:56.957 回答
0

啊哈!我们找到了问题的原因:链接导航助手 http://framework.zend.com/manual/en/zend.view.helpers.html#zend.view.helpers.initial.navigation.links

我们仍然没有真正的解决方案,但那些头部链接并不那么重要。我们不再使用它了。

于 2012-05-04T08:32:51.037 回答