Test implementation:
https://github.com/cyberalien/phpbb3/tr ... /includejsIt also includes second test style: progreen, that inherits from prosilver.
Implemented instructions:
- Code: Select all
<!-- INCLUDEJS test.js -->
This will locate file test.js and append code for it to variable {SCRIPTS}. If file is not found, locator returns url to where file is supposed to be in current style.
Then in overall_footer.html after jQuery I've added variable {SCRIPTS}
It also works with template variables, like this:
- Code: Select all
<!-- DEFINE $TEST = 'test.js' -->
<!-- INCLUDEJS {$TEST} -->
In cases like this files are located dynamically during template display, so its a bit lower than hard coded file names.
In order to implement that, I had to add some other functionality that might be useful for other modifications:
- $template->context->append_var(var, value) - append to template variable (maybe add template->append_var for it too?)
- $template->locate(file, is_template) - finds file, returns file name relative to phpBB root directory. If second parameter is true, $file is relative to template directory, if false, $file is relative to style directory.
Formerly known as CyberAlien.