<?php
class LayoutPlugin extends Yaf_Plugin_Abstract
{
public function preDispatch(Yaf_Request_Abstract $request, Yaf_Response_Abstract $response)
{
/* pick the template directory based on the module, right
* before the action is dispatched */
$view = Yaf_Dispatcher::getInstance()->getView();
if ($request->getModuleName() == "Admin") {
$view->setScriptPath(APPLICATION_PATH . "/modules/admin/views");
}
}
}
/* plugins are registered in the bootstrap */
class Bootstrap extends Yaf_Bootstrap_Abstract
{
public function _initPlugin(Yaf_Dispatcher $dispatcher)
{
$dispatcher->registerPlugin(new LayoutPlugin());
}
}
?>