Skip to content

Instantly share code, notes, and snippets.

@tdutrion
Last active February 27, 2017 10:27
Show Gist options
  • Save tdutrion/6b6946fc2656cd3ff2de to your computer and use it in GitHub Desktop.
Save tdutrion/6b6946fc2656cd3ff2de to your computer and use it in GitHub Desktop.
ZF2 navigation in config folder
<?php
return [
'navigation' => [
'default' => [
[
'label' => 'Home',
'route' => 'home',
'pages' => [
[
'route' => 'news',
],
],
],
[
'label' => 'Parties',
'route' => 'party/list',
'pages' => [
[
'route' => 'party',
],
[
'route' => 'party/details',
],
],
],
],
],
'service_manager' => [
'factories' => [
'navigation' => 'Zend\Navigation\Service\DefaultNavigationFactory',
],
],
];
<?= $this->doctype() ?>
<html lang="en">
<head>
<meta charset="utf-8">
<?= $this->headLink() ?>
<?= $this->headScript() ?>
</head>
<body>
<nav>
<?= $this->navigation('navigation')->menu()->setUlClass('nav nav-pills')->setMaxDepth(0) ?>
</nav>
<?= $this->content ?>
<?= $this->inlineScript() ?>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment