Dynamiczne menu ZF2 z nawigacją Zend Nawigacja

Chcę cię zapytać o ten problem. Co jest potrzebne do tworzenia dynamicznego menu z nawigacją Zend?

W ZF1 zrobiłem tak:

$container = new Zend_Navigation();
$pages = array(
array(
    'label'  => 'Save',
    'action' => 'save',
),
array(
    'label'  => 'Delete',
    'action' => 'delete',
),
);
// add two pages
$container->addPages($pages);

a następnie w widoku:

$this->navigation()->menu();

Ale w ZF2 strony pobierają z config. Teraz tworzę config autoload nav.global.php i tutaj tworzę tablicę stron. Ale muszę zrobić metodę tablicy stron i wysłać ją do pomocnika nawigacji, ale ii nie wiem jak ((

Próbowałem to zrobić w moim kontrolerze:

use Zend\Navigation\Navigation;
$pages =array(
        // All navigation-related configuration is collected in the 'navigation' key
        'navigation' => array(
            // The DefaultNavigationFactory we configured in (1) uses 'default' as the sitemap key
            'default' => array(
                // And finally, here is where we define our page hierarchy
                'account' => array(
                    'label' => 'faq',
                    'route' => 'faq',
                    'pages' => array(
                        'news' => array(
                            'label' => 'news',
                            'route' => 'news',
                            ),
                            'manual' => array(
                            'label' => 'manual',
                            'route' => 'manual',
                            ),               
                    ),
                ),
            ),
        ),
    );
$Menu = new Navigation($pages);

a potem to w widoku:

$this->Menu()->menu();

ale mam wiele błędów ...

Myślę, że rozumiesz mój problem. proszę pomóż. przepraszam za mój angielski.

questionAnswers(5)

yourAnswerToTheQuestion