If are using Zend_Navigation and wish to use mutliple xml Zend_Config_Xml files to build your Navigation object then it is possible to merge xml configuration files using Zend_Config::merge and pass the resulting object into Zend_Navigation. (e.g if a module/plugin wishes to append further navigation elements into your main navigation.xml)
The following example will merge two different xml config files and pass the resulting config to Zend_Navigation
//Make an empty Zend_Config object
$config = new Zend_Config( array(), true);
//Merge 1st xml file (navigation.xml)
$config->merge(
new Zend_Config_Xml(
APPLICATION_PATH . '/configs/navigation.xml',
'nav'
)
);
//Merge 2nd xml file (navigation2.xml)
$config->merge(
new Zend_Config_Xml(
APPLICATION_PATH . '/configs/navigation2.xml',
'nav'
)
);
//Pass the resulting config to Zend_Navigation
$navigation = new Zend_Navigation($config);

0 comments:
Post a Comment