diff --git a/src/mibew/install/dbinfo.php b/src/mibew/install/dbinfo.php index d0381c6c..060b4239 100644 --- a/src/mibew/install/dbinfo.php +++ b/src/mibew/install/dbinfo.php @@ -298,7 +298,8 @@ function show_install_err($text) 'errors' => array($text), ); $page_style = new \Mibew\Style\PageStyle('default'); - $page_style->render('install_err', $page); + start_html_output(); + echo($page_style->render('install_err', $page)); exit; } diff --git a/src/mibew/install/index.php b/src/mibew/install/index.php index f9b1b42d..77582e64 100644 --- a/src/mibew/install/index.php +++ b/src/mibew/install/index.php @@ -395,6 +395,8 @@ $page['fixedwrap'] = true; $page['errors'] = $errors; $page_style = new \Mibew\Style\PageStyle('default'); -$page_style->render('install_index', $page); + +start_html_output(); +echo($page_style->render('install_index', $page)); ?> \ No newline at end of file diff --git a/src/mibew/libs/classes/Mibew/Controller/AbstractController.php b/src/mibew/libs/classes/Mibew/Controller/AbstractController.php index 2eaa19c8..081f4f94 100644 --- a/src/mibew/libs/classes/Mibew/Controller/AbstractController.php +++ b/src/mibew/libs/classes/Mibew/Controller/AbstractController.php @@ -118,13 +118,7 @@ abstract class AbstractController implements RouterAwareInterface, Authenticatio */ public function render($template, array $parameters = array()) { - // TODO: Remove bufferization after all pages will be replaced with - // controllers and direct output will be removed from the *Style classes. - ob_start(); - $this->getStyle()->render($template, $parameters); - $content = ob_get_clean(); - - return $content; + return $this->getStyle()->render($template, $parameters); } /** diff --git a/src/mibew/libs/classes/Mibew/Style/ChatStyle.php b/src/mibew/libs/classes/Mibew/Style/ChatStyle.php index 920b905c..6fa1028d 100644 --- a/src/mibew/libs/classes/Mibew/Style/ChatStyle.php +++ b/src/mibew/libs/classes/Mibew/Style/ChatStyle.php @@ -69,17 +69,16 @@ class ChatStyle extends AbstractStyle implements StyleInterface } /** - * Renders template file to HTML and send it to the output + * Renders template file to HTML. * * @param string $template_name Name of the template file with neither path * nor extension. * @param array $data Associative array of values that should be used for * substitutions in a template. + * @return string Rendered template. */ public function render($template_name, $data = array()) { - start_html_output(); - // Pass additional variables to template $data['mibewRoot'] = MIBEW_WEB_ROOT; $data['mibewVersion'] = MIBEW_VERSION; @@ -88,7 +87,7 @@ class ChatStyle extends AbstractStyle implements StyleInterface $data['stylePath'] = MIBEW_WEB_ROOT . '/' . $this->getFilesPath(); $data['styleName'] = $this->getName(); - echo($this->templateEngine->render($template_name, $data)); + return $this->templateEngine->render($template_name, $data); } /** diff --git a/src/mibew/libs/classes/Mibew/Style/PageStyle.php b/src/mibew/libs/classes/Mibew/Style/PageStyle.php index 7aaa700a..d4c3066c 100644 --- a/src/mibew/libs/classes/Mibew/Style/PageStyle.php +++ b/src/mibew/libs/classes/Mibew/Style/PageStyle.php @@ -69,18 +69,16 @@ class PageStyle extends AbstractStyle implements StyleInterface } /** - * Renders template file to HTML and send it to the output + * Renders template file to HTML. * * @param string $template_name Name of the template file with neither path * nor extension. * @param array $data Associative array of values that should be used for * substitutions in a template. + * @return string Rendered template. */ public function render($template_name, $data = array()) { - // Prepare to output html - start_html_output(); - // Pass additional variables to template $data['mibewRoot'] = MIBEW_WEB_ROOT; $data['mibewVersion'] = MIBEW_VERSION; @@ -89,7 +87,7 @@ class PageStyle extends AbstractStyle implements StyleInterface $data['stylePath'] = MIBEW_WEB_ROOT . '/' . $this->getFilesPath(); $data['styleName'] = $this->getName(); - echo($this->templateEngine->render($template_name, $data)); + return $this->templateEngine->render($template_name, $data); } /** diff --git a/src/mibew/libs/classes/Mibew/Style/StyleInterface.php b/src/mibew/libs/classes/Mibew/Style/StyleInterface.php index d22c0f88..aeb1c610 100644 --- a/src/mibew/libs/classes/Mibew/Style/StyleInterface.php +++ b/src/mibew/libs/classes/Mibew/Style/StyleInterface.php @@ -77,12 +77,13 @@ interface StyleInterface public function getName(); /** - * Renders template file to HTML and send it to the output + * Renders template file to HTML. * * @param string $template_name Name of the template file with neither path * nor extension. * @param array $data Associative array of values that should be used for * substitutions in a template. + * @return string Rendered template. */ public function render($template_name, $data = array()); }