meder omuraliev
meder omuraliev

Reputation: 186562

Zend: Creating breadcrumb navigation with Zend_Config_Xml and Zend_Navigation

I'm having an issue, an exception is thrown when Zend_Navigation is being invoked on an instance of Zend_Config_Xml.

Here's the method in which it fails in ( Bootstrap.php ):

protected function _initNavigation() {
$this->bootstrap('layout');
$layout = $this->getResource('layout');
$view = $layout->getView();
$config = new Zend_Config_Xml( APPLICATION_PATH . '/configs/navigation.xml' );
$navigation = new Zend_Navigation( $config ); // exception is thrown here
$view->navigation( $navigation );
}

The XML file being parsed is EXACTLY a copy of example 37.11 @ http://framework.zend.com/manual/en/zend.navigation.containers.html

The error being thrown:

Perhaps I'm missing something, or the xml structure needs to be altered/customized?

Upvotes: 0

Views: 3341

Answers (1)

Champo
Champo

Reputation: 3419

Your instancing Zend_Config_Xml differently than the example says. You forgot to specify the section as a second parameter.

$config = new Zend_Config_Xml( APPLICATION_PATH . '/configs/navigation.xml', 'nav' );

If you add the , 'nav' bit there, assumming your xml is exactly like the one in the link, it should work.

Upvotes: 4

Related Questions