diff options
author | Oleg Pudeyev <oleg@bsdpower.com> | 2011-08-07 15:33:45 -0400 |
---|---|---|
committer | Oleg Pudeyev <oleg@bsdpower.com> | 2011-08-07 15:35:35 -0400 |
commit | 0b381516a0e7f3559fb697d98aa28e480c60b823 (patch) | |
tree | e865989acf468b59c6204e93064980b833283026 /phpBB/includes/template | |
parent | 52f208900fb6baa470d0238829147b60e208060d (diff) | |
download | forums-0b381516a0e7f3559fb697d98aa28e480c60b823.tar forums-0b381516a0e7f3559fb697d98aa28e480c60b823.tar.gz forums-0b381516a0e7f3559fb697d98aa28e480c60b823.tar.bz2 forums-0b381516a0e7f3559fb697d98aa28e480c60b823.tar.xz forums-0b381516a0e7f3559fb697d98aa28e480c60b823.zip |
[feature/template-engine] Create load_and_render to reduce code duplication.
PHPBB3-9726
Diffstat (limited to 'phpBB/includes/template')
-rw-r--r-- | phpBB/includes/template/template.php | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/phpBB/includes/template/template.php b/phpBB/includes/template/template.php index ad5581499d..c368fd2621 100644 --- a/phpBB/includes/template/template.php +++ b/phpBB/includes/template/template.php @@ -188,6 +188,18 @@ class phpbb_template return $result[0]; } + return $this->load_and_render($handle); + } + + /** + * Loads a template for $handle, compiling it if necessary, and + * renders the template. + * + * @param string $handle Template handle to render + * @return bool True on success, false on failure + */ + private function load_and_render($handle) + { $renderer = $this->_tpl_load($handle); if ($renderer) @@ -425,13 +437,7 @@ class phpbb_template { $this->locator->set_filenames(array($filename => $filename)); - $renderer = $this->_tpl_load($filename); - - if ($renderer) - { - $renderer->render($this->context, $this->get_lang()); - } - else + if (!$this->load_and_render($handle)) { // trigger_error cannot be used here, as the output already started echo 'template->_tpl_include(): Failed including ' . htmlspecialchars($handle) . "\n"; |