Created
March 6, 2012 21:53
-
-
Save weierophinney/1989166 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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