Skip to content

Instantly share code, notes, and snippets.

@weierophinney
Created March 6, 2012 21:53
Show Gist options
  • Save weierophinney/1989166 to your computer and use it in GitHub Desktop.
Save weierophinney/1989166 to your computer and use it in GitHub Desktop.
<?php
namespace Frontend;
use Zend\EventManager\StaticEventManager;
class Module
{
public function init()
{
$events = StaticEventManager::getInstance();
$events->attach('bootstrap', 'bootstrap', array($this, 'bootstrap'));
}
public function bootstrap($e)
{
$app = $e->getParam('application');
$e->events()->attach('route', array($this, 'seedTemplates'), -100);
}
public function seedTemplates($e)
{
$routeMatch = $e->getRouteMatch();
$controller = $routeMatch->getParam('controller');
if (substr($controller, __NAMESPACE__) !== 0) {
// not our controller; done
return;
}
$app = $e->getParam('application');
$locator = $app->getLocator();
$config = $app->getConfig();
// use config, locator, etc. to re-seed or seed paths for the
// templates used by this module
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment