doudui5753 2010-04-02 12:28
浏览 54
已采纳

Zend_Navigation无法加载

Following on from my earlier question, I am still having issues with loading the xml file into Zend_Navigation.

I am now getting the following error message:

<b>Fatal error</b>:  Uncaught exception 'Zend_Navigation_Exception' with message 'Invalid argument: Unable to determine class to instantiate' in C:\www\mysite\development\website\library\Zend\Navigation\Page.php:223

I've tried to make my navigation.xml file look similar to the example on the Zend Documentation, However I just can't seem to get it to work. My XML file looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<configdata>
 <navigation>

    <default>
        <label>Home</label>
        <controller>index</controller>
        <action>index</action>
        <module>default</module>

        <pages>
            <tour>
                <label>Tour</label>
                <controller>tour</controller>
                <action>index</action>
                <module>default</module>
            </tour>

            <blog>
                <label></label>
                <uri>http://blog.mysite.com</uri>                   
            </blog>

            <support>
                <label>Support</label>
                <controller>support</controller>
                <action>index</action>
                <module>default</module>
            </support>
        </pages>
     </default>

     <users>
        <label>Home</label>
        <controller>index</controller>
        <action>index</action>
        <module>users</module>
        <role>guser</role>
        <resource>owner</resource>

        <pages>

            <jobmanger>
                <label>Job Manager</label>
                <controller>jobmanager</controller>
                <action>index</action>
                <module>users</module>
                <role>guser</role>
                <resource>owner</resource>
            </jobmanger>

            <myaccount>
                <label>My Account</label>
                <controller>profile</controller>
                <action>index</action>
                <role>guser</role>
                <resource>owner</resource>
                <module>users</module>
                <pages>

                    <detail>
                        <label>Account Details</label>
                        <controller>profile</controller>
                        <action>detail</action>
                        <module>users</module>
                        <role>guser</role>
                        <resource>owner</resource>

                        <pages>
                            <history>
                                <label>Account History</label>
                                <controller>profile</controller>
                                <action>history</action>
                                <module>users</module>
                                <role>guser</role>
                                <resource>owner</resource>
                            </history>

                            <password>
                                <label>Change Password</label>
                                <controller>profile</controller>
                                <action>changepwd</action>
                                <module>users</module>
                                <role>employer</role>
                                <resource>employers</resource>
                            </password>
                        </pages>
                    </detail>

...
</navigation>
</configdata>

I am loading this xml into the bootstrap as follows:

 $configNav = new Zend_Config_Xml('../application/config/navigation.xml', 'navigation');
 $navigation = new Zend_Navigation($configNav);
 $navView->navigation($navigation);

Now I confess that I've totally got the wrong end of the stick with this, but rapidly running out of ideas, and it's been a long week.

Thanks,

Grant

  • 写回答

2条回答 默认 最新

  • dsbtwy1329 2010-04-02 13:57
    关注

    Zend_Navigation appears to determine whether or not to use an Mvc page or Uri page by checking for the existence of either the controller, action and module keys; or a uri key. The error you're reporting is generated if neither of these conditions are met. All of the examples in your XML document look fine, so I would guess that a some point later in the XML file you are missing one of the required keys for one of your pages. E.g. you have an action and controller but no module.

    If you aren't able to spot which one is causing the problem, I would suggest temporarily adding a debug line to Zend_Navigation by inserting:

    var_dump($options);exit;
    

    into line 222 of Zend/Navigation/Page.php. This would print out the keys for the element that is causing the error, which should help you work out which one in your XML doc it is. Remove this line again once you've fixed it!

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘