A brutal rip-off of the Zend Framework web site PageController module, written by Matthew Weier O'Phinney. All credit goes to him.
MyPages is a very simple Zend Framework 2 module, providing a basic Controller that resolves view templates from the route.
- Put your view templates inside the
pagessub directory of a path registered as a
- Add your routes specifying
MyPages\PageControlleras the controller and the template name as the
// somewhere in your router config 'static-page-route' => [ 'type' => 'literal', 'options' => [ 'route' => '/static-page' 'defaults' => [ 'controller' => 'MyPages\PageController', 'page' => 'static-page-template', ], ], ]
this will render the first resolved
pages/static-page-template view when the route matches
Of course, you can use any other resolver config that works for you.
There are two settings you can change:
// somewhere in your autoloaded configs 'MyPages' => [ 'route_param_name' => 'page', 'template_dir' => 'pages', ],