public function preDispatch()
{
$themesService = \Zend_Registry::get('container')->getService('newscoop_newscoop.themes_service');
$controller = $this->getActionController();
$GLOBALS['controller'] = $controller;
$request = $this->getRequest();
$format = $request->getParam('format', null);
if (isset($format) && $format == "json") {
return;
}
if (!in_array($request->getParam('module', 'default'), $this->modules) || !array_key_exists('module', $request->getParams())) {
return;
}
$themePath = $themesService->getThemePath();
$controller->view = new Newscoop\SmartyView();
$controller->view->addScriptPath(APPLICATION_PATH . '/views/scripts/')->addScriptPath(realpath(APPLICATION_PATH . "/../themes/{$themePath}"));
$controller->view->addPath(realpath(APPLICATION_PATH . "/../themes/{$themePath}"));
$controller->getHelper('viewRenderer')->setView($controller->view)->setViewScriptPathSpec(':controller_:action.:suffix')->setViewSuffix('tpl');
$controller->getHelper('layout')->disableLayout();
// reverse templates directory order
\CampTemplate::singleton()->setTemplateDir(array_reverse(\CampTemplate::singleton()->getTemplateDir()));
}