mirror of
https://github.com/Mibew/mibew.git
synced 2025-03-03 18:38:31 +03:00
Do not output content in "*Style::render" methods
This commit is contained in:
parent
80f1fbbce7
commit
390391d117
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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));
|
||||
|
||||
?>
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user