/** * Renders the view and returns the content * * @param string $title The title to be shown * @param string $message The message to be shown * @param int $severity The severity of the error, see AbstractMessage constants * @param int $errorCode The error code to be referenced * @return string the output of the view */ public function errorAction(string $title, string $message, int $severity = AbstractMessage::ERROR, int $errorCode = 0) : string { $this->severity = $severity; $classes = [AbstractMessage::NOTICE => 'notice', AbstractMessage::INFO => 'information', AbstractMessage::OK => 'ok', AbstractMessage::WARNING => 'warning', AbstractMessage::ERROR => 'error']; $this->view->assign('severityCssClass', $classes[$this->severity]); $this->view->assign('severity', $this->severity); $this->view->assign('message', $message); $this->view->assign('title', $title); $this->view->assign('errorCodeUrlPrefix', TYPO3_URL_EXCEPTION); $this->view->assign('errorCode', $errorCode); $this->view->assign('logo', PathUtility::getAbsoluteWebPath(ExtensionManagementUtility::extPath('backend', 'Resources/Public/Images/typo3_orange.svg'))); $this->view->assign('cssFile', PathUtility::getAbsoluteWebPath(ExtensionManagementUtility::extPath('core', 'Resources/Public/Css/errorpage.css'))); $this->view->assign('copyrightYear', TYPO3_copyright_year); return $this->view->render('Error'); }
public function render($template, $variables = array()) { $paths = new \TYPO3Fluid\Fluid\View\TemplatePaths(); // $paths->setTemplateRootPaths(array(__DIR__ . '/../Templates/')); $paths->setLayoutRootPaths(array(BASE_DIRECTORY . '/../Resources/Layouts/')); $paths->setPartialRootPaths(array(BASE_DIRECTORY . '/../Resources/Partials/')); $parts = explode('/', $template); array_walk($parts, function (&$value, $key) { $value = ucfirst($value); }); $path = implode('/', $parts); $templateFile = BASE_DIRECTORY . '/../Resources/Templates/' . $path . '.html'; $paths->setTemplatePathAndFilename($templateFile); $view = new TemplateView($paths); $view->assignMultiple($variables); $view->getViewHelperResolver()->registerNamespace('s', 'Famelo\\Soup\\ViewHelpers'); echo $view->render(); }
public function render($template) { $this->view->getTemplatePaths()->setTemplatePathAndFilename(ROOT_PATH . '/Templates/' . $template . '.html'); echo $this->view->render(); }