Skip to content

Instantly share code, notes, and snippets.

@renepardon
Created September 10, 2011 15:39
Show Gist options
  • Select an option

  • Save renepardon/1208445 to your computer and use it in GitHub Desktop.

Select an option

Save renepardon/1208445 to your computer and use it in GitHub Desktop.
<?php
// Base navigation.
$configPath = APPLICATION_PATH . '/configs/navigation/admin/';
$config = new \Zend_Config_Xml($configPath . 'base.xml', 'navigation', true);
// Create base navigation.
$navigation = new \Zend_Navigation($config);
// Module navigations.
$iterator = new \DirectoryIterator($configPath);
while ($iterator->valid())
{
if ($iterator->getFilename() == '.'
|| $iterator->getFilename() == '..'
|| $iterator->getFilename() == 'base.xml') {
$iterator->next();
continue;
}
// Create new module navigation.
$moduleConfig = new \Zend_Config_Xml($configPath . $iterator->getFilename(), 'navigation', true);
// Add module pages to base navigation.
$navigation->addPages($moduleConfig);
$iterator->next();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment