stefanotorresi / my-pages
A brutal rip-off of the Zend Framework web site PageController module, written by Matthew Weier O'Phinney. All credit goes to him.
Requires
- php: >=5.4.1
- stefanotorresi/my-base: 1.*
- zendframework/zendframework: 2.*
Suggests
- phly/phly-simple-page: A more comprehensive module than MyPage
This package is auto-updated.
Last update: 2022-02-01 12:26:24 UTC
README
MyPages is a very simple Zend Framework 2 module, providing a basic Controller that resolves view templates from the route.
Usage
- Put your view templates inside the
pages
sub directory of a path registered as atemplate_path_stack
with theViewManager
. - Add your routes specifying
MyPages\PageController
as the controller and the template name as thepage
param:
// 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 /static-page
.
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', ],
Credits
The module is just a brutal rip-off of the Zend Framework web site PageController module, written by Matthew Weier O'Phinney. All credits go to him.
For a more complete module with functionalities like caching, check out Matthew Weier O'Phinney's PhlySimplePage module.