diff options
| author | Vjacheslav Trushkin <arty@phpbb.com> | 2012-04-01 10:58:24 +0300 |
|---|---|---|
| committer | Vjacheslav Trushkin <arty@phpbb.com> | 2012-04-01 10:58:24 +0300 |
| commit | a7d0ef90ea921b2ed876bb933bfa022863771a6e (patch) | |
| tree | 4e4f46caf99fdce436a37feed45d4ee2175589ae /phpBB/includes/style/template.php | |
| parent | 2509853ca530b3b5e0d5b2e10080eeba5a29d937 (diff) | |
| download | forums-a7d0ef90ea921b2ed876bb933bfa022863771a6e.tar forums-a7d0ef90ea921b2ed876bb933bfa022863771a6e.tar.gz forums-a7d0ef90ea921b2ed876bb933bfa022863771a6e.tar.bz2 forums-a7d0ef90ea921b2ed876bb933bfa022863771a6e.tar.xz forums-a7d0ef90ea921b2ed876bb933bfa022863771a6e.zip | |
[ticket/10665] INCLUDEJS template tag
Implementing INLCUDEJS template tag in style classes
PHPBB3-10665
Diffstat (limited to 'phpBB/includes/style/template.php')
| -rw-r--r-- | phpBB/includes/style/template.php | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/phpBB/includes/style/template.php b/phpBB/includes/style/template.php index aebf1da603..4586e8dbf9 100644 --- a/phpBB/includes/style/template.php +++ b/phpBB/includes/style/template.php @@ -288,7 +288,7 @@ class phpbb_style_template return new phpbb_style_template_renderer_include($output_file, $this); } - $compile = new phpbb_style_template_compile($this->config['tpl_allow_php']); + $compile = new phpbb_style_template_compile($this->config['tpl_allow_php'], $this->locator, $this->phpbb_root_path); if ($compile->compile_file_to_file($source_file, $output_file) !== false) { @@ -492,4 +492,23 @@ class phpbb_style_template // use resource locator to find files return $this->locator->get_first_file_location($templates, $return_default, $return_full_path); } + + /** + * Include JS file + * + * @param string $file file name + * @param bool $locate True if file needs to be located + */ + function _js_include($file, $locate = false) + { + // Locate file + if ($locate) + { + $file = $this->locator->get_first_file_location(array($file), true, true); + } + + // Add HTML code + $code = '<script src="' . htmlspecialchars($file) . '"></script>'; + $this->context->append_var('SCRIPTS', $code); + } } |
