php - creating dynamic navigation in zf3 -


i using zend framework3 in project. able create static navigation following docs link

now have fetch menu data database create navigation. using have provide configuration module.config.php config file of album module.

  <?php   namespace album;    use zend\router\http\literal;   use zend\router\http\segment;   use zend\servicemanager\factory\invokablefactory;   use zend\navigation\service\defaultnavigationfactory;   use album\navigation\albumnavigationfactory;    return [     'controllers' => [       'factories' => [          controller\albumcontroller::class => factory\albumcontrollerfactory::class,         controller\indexcontroller::class => invokablefactory::class,           ],        ],       // add section:     'service_manager' => [         'factories' => [            'navigation' => navigation\albumnavigationfactory::class,             model\albumtable::class => factory\albumtablefactory::class,          ],        ],      // following section new , should added file:      'router' => [         'routes' => [         'album' => [             'type'    => segment::class,             'options' => [                 'route' => '/album[/:action[/:id]]',                 'constraints' => [                     'action' => '[a-za-z][a-za-z0-9_-]*',                     'id'     => '[0-9]+',                 ],                 'defaults' => [                     'controller' => controller\albumcontroller::class,                     'action'     => 'index',                 ],             ],         ],         'index' => [             'type'    => segment::class,             'options' => [                 'route' => '/index[/:action[/:id]]',                 'constraints' => [                     'action' => '[a-za-z][a-za-z0-9_-]*',                     'id'     => '[0-9]+',                 ],                 'defaults' => [                     'controller' => controller\indexcontroller::class,                     'action'     => 'index',                 ],               ],             ],          ],       ],       'view_manager' => [         'template_path_stack' => [           'album' => __dir__ . '/../view',        ],     ],   ]; 

in zend framework2 simple pass navigation key factory class as

    return array(         'factories' => array(             'navigation' => 'album\navigation\albumnavigationfactory'          ),     ); 

in zend framework3 doing same thing below

    'service_manager' => [        'factories' => [          'navigation' => navigation\albumnavigationfactory::class,           model\albumtable::class => factory\albumtablefactory::class,         ],     ], 

i using navigation\albumnavigationfactory::class call factory fetching data. not able navigation. appreciated.

i don't know if it's looking for, recommend take on page:

https://github.com/fabiopaiva/zf2-navigation-bootstrap3


Comments

Popular posts from this blog

javascript - React Maximum Callstack when adding component -

javascript - Uncaught FirebaseError: Messaging: This method is available in a Window context -

correlation - Autocorrelation in Matlab WITHOUT xcorr -