Zend_Navigation not loading

Following the previous question , I'm still having problems loading the xml file into Zend_Navigation.

Now I get 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 tried to make my navigation.xml file look like an example in Zend Documentation , but I just can't seem to make it work. My xml file is as follows:

 <?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 load this xml into 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 had a complete lack of stick with this, but quickly ended up with ideas, and it was a long week.

Thanks,

Grant

+4
source share
2 answers

Zend_Navigation determines whether to use the Mvc page or the Uri page, checking for the presence of controller keys, actions, and a module; or uri key. An error message is generated if none of these conditions are met. All the examples in your XML document look great, so I would suggest that at some point in the XML file you are missing one of the necessary keys for one of your pages. For instance. you have an action and controller, but no module.

If you cannot determine which one is causing the problem, I would suggest temporarily adding a debug line to Zend_Navigation by inserting:

 var_dump($options);exit; 

to line 222 Zend / Navigation / Page.php. This will print the keys for the error element, which should help you determine which one is in your XML document. Delete this line again as soon as you fix it!

+3
source

I also had this error recently when I accidentally added 2 entries for one of the pages.

+1
source

Source: https://habr.com/ru/post/1305841/


All Articles