private function template() { $config = new Config($this->registry); $twigPath = $config->getTWIGPath(); $this->themeUrl = $this->registry->siteUrl . 'themes/' . $this->registry->template . '/'; $this->isAjaxRequest = $this->registry->dispatcher->isAjaxRequest(); require $twigPath; \Twig_Autoloader::register(); $loader = new \Twig_Loader_Filesystem($this->getTemplate()); $twig = new \Twig_Environment($loader); $urlFunction = new \Twig_SimpleFunction('url', function ($ctrl_action, $paramsArray = NULL) { $ctrl_action = explode('/', $ctrl_action); $controller = $ctrl_action[0] . '/'; $action = $ctrl_action[1] . '/'; $params = ''; if (isset($paramsArray)) { $params .= '?'; foreach ($paramsArray as $key => $value) { $params .= $key . '=' . $value; if (end($paramsArray) != $value) { $params .= '&'; } } } $url = $this->registry->siteUrl . $controller . $action . $params; return $url; }); $twig->addFunction($urlFunction); $template = $twig->loadTemplate($this->getView()); return $template; }