stefanotorresi/my-pages

This package is abandoned and no longer maintained. No replacement package was suggested.

A brutal rip-off of the Zend Framework web site PageController module, written by Matthew Weier O'Phinney. All credit goes to him.

0.1.1 2014-02-24 12:55 UTC

This package is auto-updated.

Last update: 2022-02-01 12:26:24 UTC


README

Latest Stable Version Latest Unstable Version Build Status Code Coverage Scrutinizer Quality Score

MyPages is a very simple Zend Framework 2 module, providing a basic Controller that resolves view templates from the route.

Usage

  1. Put your view templates inside the pages sub directory of a path registered as a template_path_stack with the ViewManager.
  2. Add your routes specifying MyPages\PageController as the controller and the template name as the page 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.